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

[BUG] JS Snippets not working anymore. #408

Open
1 task done
MathieuTricoire opened this issue Nov 7, 2023 · 3 comments · May be fixed by #410
Open
1 task done

[BUG] JS Snippets not working anymore. #408

MathieuTricoire opened this issue Nov 7, 2023 · 3 comments · May be fixed by #410

Comments

@MathieuTricoire
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

What version of workers-rs are you using?

0.0.18

What version of wrangler are you using?

3.15.0

Describe the bug

Hi everyone,

I've recently started working with Cloudflare and Cloudflare Workers, and I've encountered what appears to be a regression with "JS Snippets". Upon reviewing the repository's history, it seems that this feature was previously functioning correctly, but I suspect changes, potentially around the "glue" code, might have affected this functionality.

Error when running npm run dev
Screenshot 2023-11-07 at 4 03 14 PM

WebAssembly code:
Screenshot 2023-11-07 at 4 03 42 PM

Shim.mjs code (glue code):
Screenshot 2023-11-07 at 4 04 03 PM

Let me know if I miss something or if this is a real issue.

Thanks,
Mat

Steps To Reproduce

Use my example: https://github.com/MathieuTricoire/workers-rs/tree/fix-js-snippets/examples/js_snippets

If you clone my repo and want to be sure to reproduce the error do not forget to replace the wrangler.toml build command with something like this, since my repo contains a fix:

[build]
command = "worker-build --release"
@MathieuTricoire
Copy link
Author

FYI: I have a potential fix on my fork, let me know if you want me to create a PR.

@kflansburg
Copy link
Member

I'm not familiar with this mechanism, is this part of wasm-bindgen that we need to support in our custom glue code? I know that we treat WebAssembly imports different than other runtimes which may be the issue here. Are you using Miniflare 2 or 3?

@MathieuTricoire
Copy link
Author

Yes it's in wasm-bindgen: https://rustwasm.github.io/wasm-bindgen/reference/js-snippets.html and it was previously supported see this PR #142.

I'm using Miniflare 3.

@kflansburg kflansburg linked a pull request Nov 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants