jupyterlite/demo

Pyodide blocked by CORS

augusto-herrmann opened this issue · 2 comments

Description

The demo does not load Pyodide due to the CDN request being blocked by CORS. As a result, you cannot use a Python terminal or execute notebooks that require a working Python kernel.

The problem happens both on Firefox 123.0 and Ungoogled Chromium 95.0.4638.54.

Reproduce

  1. Using Firefox or Ungoogled Chromium, open any of the JupyterLite live demos at:
  2. Under "Console", click "Python (Pyodide).

Result: Python terminal tries to start but hangs. Browser's network analysis shows "CORS Failed" on some Pyodide resources (image below), even though when requesting them separately I can see that they do have access-control-allow-origin: * headers set, which shouldn't cause CORS errors.

jupyterlite-pyodide-cors-failed

Note: if you try to open and execute a notebook that uses Python, the execution is blocked forever waiting for the kernel, too.

Expected behavior

A working Python terminal.

Context

  • JupyterLite version: do not know, it's the one currently deployed as "latest" at the demo site. Console suggests it's 0.3.0-beta. I also tried running JupyterLite locally, version, 0.2.3, with the same result.
  • Operating System and version: unknown
  • Browser and version: tested with Fifefox 123.0 and Ungoogled Chromium 95.0.4638.54. on 64-bit Linux
Browser Output
Unsatisfied version 0.3.0-beta.0 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @jupyterlite/kernel (required ~0.1.0-beta.18) remoteEntry.9117113815033289c4d5.js:1:5416
Unsatisfied version 6.1.2 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @jupyterlab/coreutils (required ^5.5.2) remoteEntry.9117113815033289c4d5.js:1:5416
Unsatisfied version 2.1.2 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @lumino/coreutils (required ^1.11.0) remoteEntry.9117113815033289c4d5.js:1:5416
Unsatisfied version 0.3.0-beta.0 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @jupyterlite/kernel (required ~0.2.0) consumes:73:61
Unsatisfied version 0.3.0-beta.0 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @jupyterlite/contents (required ~0.2.0) consumes:73:61
Unsatisfied version 0.3.0-beta.0 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @jupyterlite/server (required ~0.2.0) consumes:73:61
Unsatisfied version 2.0.1 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @lumino/messaging (required ^1.10.0) remoteEntry.ade722230aea9b7793b2.js:1:6037
Unsatisfied version 2.3.1 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @lumino/widgets (required ^1.37.2) remoteEntry.ade722230aea9b7793b2.js:1:6037
Unsatisfied version 6.0.5 from @jupyter-widgets/jupyterlab-manager of shared singleton module @jupyter-widgets/base (required ^1.1.10 || ^2 || ^3 || ^4.0.0) remoteEntry.03390b18ed36b245b514.js:1:6189
Unsatisfied version 2.0.1 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @lumino/messaging (required ^1.10.0) remoteEntry.edc72ee71d4ec67598f6.js:1:7822
Unsatisfied version 2.3.1 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @lumino/widgets (required ^1.37.2) remoteEntry.edc72ee71d4ec67598f6.js:1:7822
Unsatisfied version 6.0.5 of shared singleton module @jupyter-widgets/base (required ^1 || ^2 || ^3 || ^4) remoteEntry.1ea7cdec7b0be3c5b34d.js:1:5546
Unsatisfied version 6.0.5 of shared singleton module @jupyter-widgets/base (required ^1 || ^2 || ^3 || ^4) remoteEntry.b8f540aa2b45806d9156.js:1:5346
Unsatisfied version 4.2.2 of shared singleton module @jupyterlab/apputils (required ^3.6.3) remoteEntry.b8f540aa2b45806d9156.js:1:5346
Unsatisfied version 2.3.1 from _JUPYTERLAB.CORE_OUTPUT of shared singleton module @lumino/widgets (required ^1.37.2) remoteEntry.f294278414d0a929e4ae.js:1:5956
JupyterLite ServiceWorker was already registered service-manager.js:40:20
Kernel filesystem and JupyterLite contents will be synced index.js:192:24
XHRGET
https://jupyterlite.readthedocs.io/en/latest/_static/github?1709501994416
[HTTP/1.1 404  0ms]

The JupyterLab GitHub server extension appears to be missing. If you do not install it with application credentials, you are likely to be rate limited by GitHub very quickly 958.22edf3675e77b075de5c.js:1:921
Referrer Policy: Die weniger eingeschränkte Referrer Policy "no-referrer-when-downgrade" für die Website-übergreifende Anfrage wird ignoriert: https://api.github.com/repos/jupyterlite/jupyterlite/contents? 958.22edf3675e77b075de5c.js:1:5310
Pyodide contents will be synced with Jupyter Contents index.js:51:28
Starting WebSocket: wss://jupyterlite.readthedocs.io/en/latest/_static/api/kernels/908f35cb-8f4b-4002-895e-bc8707c7c2af 3 default.js:69:20
wasm instantiation failed! pyodide.js:9:8837
TypeError: NetworkError when attempting to fetch resource. pyodide.js:9:8880
TypeError: NetworkError when attempting to fetch resource.
TypeError: NetworkError when attempting to fetch resource.

Thanks @augusto-herrmann for the report.

Could it be a transient CDN issue maybe?

Testing now with Chromium 122 seems to be fine:

image

Also with Firefox 124 (dev edition):

image

I'm not sure what was causing the problem, if it was an issue with the CDN or something else. Anyway, it is suddenly gone now. It all loads normally here, both on the demo and on my own deployment.

Thanks @jtpio for looking into it, and for the awesome job with Jupyter Lite!