Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Failed to construct 'Worker' -- when trying to use JupyterLite #664

Open
sskagemo opened this issue Jul 11, 2023 · 4 comments
Open
Labels

Comments

@sskagemo
Copy link

sskagemo commented Jul 11, 2023

Describe the bug

(Sorry if this is already documented elsewhere, I've tried to look through and search in existing issues and documentation, but I have to admit that this is a bit beyond my field of competence ...)

context
When I try to set up my page at https://sskagemo.github.io/pythonevangelisten.no/blog/2023/07/test-av-thebe-for-interaktiv-kode-i-nettleseren/ (sorry for the Norwegian ...) similar to your demo of JuypyterLite, here https://executablebooks.github.io/thebe/lite.html

expectation
I expected it to work in a similar way

bug
But instead the code-block does not change to interactive mode (I have configured the code-selector with "selector": "code")

I've looked into the Chrome developer tools, and in the console I see the following error:

tslib.es6.js:72 Uncaught (in promise) Error: Failed to construct 'Worker': Script at 'https://unpkg.com/thebe-lite@latest/dist/lib/328.thebe-lite.min.js' cannot be accessed from origin 'https://sskagemo.github.io'.
    at F.initWorker (kernel.js:32:16)
    at new F (kernel.js:18:29)
    at create (index.js:56:24)
    at async w.startNew (kernels.js:116:15)
    at async P.startNew (sessions.js:94:15)
    at async index.js:347:19
    at async t.startSession (restapi.js:89:11)
    at async c.startNew (manager.js:135:15)

problem
This is a problem for people trying to do what is documented here https://mystmd.org/thebe/quickstart-lite (at least that was what I was trying to do :-))

Reproduce the bug

Test the code on https://sskagemo.github.io/pythonevangelisten.no/blog/2023/07/test-av-thebe-for-interaktiv-kode-i-nettleseren/

List your environment

Chrome Versjon 114.0.5735.199 on Windows 11 Enterprise

@sskagemo sskagemo added the bug label Jul 11, 2023
@welcome
Copy link

welcome bot commented Jul 11, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@stevejpurves
Copy link
Member

stevejpurves commented Jul 11, 2023

Hi @sskagemo! thanks for reporting this.

Looks like there's a CORS issue stopping the chunks from loading -- that's unexpected but perhaps the unpkg.com route laid out in the docs is going to be problematic for github pages.

The best thing to do would be to deploy all the thebe-lite javascript assets with your build, if you look at the github pages deploy of the thebe example site you'll see that we deploy the javascript rather than trying to pick it up from cdn.

Your script tag would then change to something like:

<script type="text/javascript" src="/thebe-lite.min.js"></script>

There is a script available in packages/core/bin/copy-thebe-assets.cjs that can help with the copy step (also see this PR for running that with npx) I'll need to update the docs to reflect this way of doing things.

@sskagemo
Copy link
Author

Thank you, I'll try that!

@stevejpurves
Copy link
Member

stevejpurves commented Jul 14, 2023

@sskagemo I've been working on improving this -- still some way to go but see this repo for an example deployment setup https://github.com/stevejpurves/lite-quickstart-example and updated docs https://mystmd.org/thebe/quickstart-lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants