@@ -37,8 +37,21 @@ server.listen(PORT, () => {
3737 let pyodide = await loadPyodide ( ) ;
3838 await pyodide . loadPackage ( "micropip" ) ;
3939 const micropip = pyodide . pyimport ( "micropip" ) ;
40- // Read packages to install from environment variable as JSON
4140
41+ // TEMPORARY WORKAROUND (added 2026-04-19, auto-disables 2026-05-03):
42+ // authlib 1.7+ requires cryptography>=45.0.1, which has no pure-Python wheel;
43+ // the streamlit-pinned Pyodide 0.26.2 only ships cryptography 43.x, so
44+ // micropip resolution fails. Preload Pyodide's built cryptography and cap
45+ // authlib below 1.7 to satisfy the transitive requirement. Revisit once
46+ // stlite bumps to a Pyodide release that ships cryptography>=45.0.1
47+ // (Pyodide 0.29.0 already does). After the expiry date, the workaround is
48+ // skipped — if it's still needed the install will fail loudly.
49+ if ( new Date ( ) < new Date ( "2026-05-03" ) ) {
50+ await pyodide . loadPackage ( [ "cryptography" , "ssl" ] ) ;
51+ await micropip . install ( "authlib<1.7" ) ;
52+ }
53+
54+ // Read packages to install from environment variable as JSON
4255 const packages = JSON . parse ( process . env . PACKAGES ) ;
4356 for ( const pkg of packages ) {
4457 await micropip . install ( pkg ) ;
@@ -51,5 +64,9 @@ server.listen(PORT, () => {
5164 test_cognite_sdk ( ) . then ( ( result ) => {
5265 console . log ( "Response from Python =" , result ) ;
5366 server . close ( ) ;
67+ } ) . catch ( ( err ) => {
68+ console . error ( "Pyodide test failed:" , err && err . stack ? err . stack : err ) ;
69+ server . close ( ) ;
70+ process . exit ( 1 ) ;
5471 } ) ;
5572} ) ;
0 commit comments