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: Error with Rust 1.82.0 in Wrangler #668

Open
agustfricke opened this issue Oct 19, 2024 · 7 comments · May be fixed by #670
Open

🐛 BUG: Error with Rust 1.82.0 in Wrangler #668

agustfricke opened this issue Oct 19, 2024 · 7 comments · May be fixed by #670
Labels
bug Something isn't working

Comments

@agustfricke
Copy link

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

wrangler 3.81.0, rustc 1.82.0

What version of Node are you using?

20.10.0

What operating system and version are you using?

Ubuntu 22.04

Describe the Bug

Observed behavior

When using Rust version 1.82.0, running npx wrangler dev or npx wrangler deploy can result in an error related to WebAssembly imports. The error message may vary slightly but typically includes.
✘ [ERROR] service core:user:rs-worker: Uncaught LinkError: WebAssembly.Instance(): Import cloudflare/workers-sdk#2 "./index_bg.js" "__wbg_fetch_bc7c8e27076a5c84": function import requires a callable at null. (shim.js:41:9)
✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above.

When downgrading to Rust version 1.81.0, the problem disappears and everything works as expected.

Expected behavior

The runtime should start successfully when using npx wrangler dev or npx wrangler deploy without producing errors in the console.

Steps to reproduce

Please provide the following:

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

✘ [ERROR] service core:user:rs-worker: Uncaught LinkError: WebAssembly.Instance(): Import cloudflare/workers-sdk#2 "./index_bg.js" "__wbg_fetch_bc7c8e27076a5c84": function import requires a callable at null. (shim.js:41:9)
✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above.

@LimesKey
Copy link

I have the same bug

@o-az
Copy link

o-az commented Oct 28, 2024

same here. Tried running all the templates no success

@kornelski
Copy link

kornelski commented Nov 19, 2024

Edit: run cargo update, and it should work now. No patch needed.

@mcrypwd
Copy link

mcrypwd commented Nov 25, 2024

This work around worked for me. I was having the same issue. Thanks.

fornwall added a commit to fornwall/advent-of-code that referenced this issue Nov 28, 2024
fornwall added a commit to fornwall/advent-of-code that referenced this issue Nov 28, 2024
fornwall added a commit to fornwall/advent-of-code that referenced this issue Nov 28, 2024
@jakeswenson
Copy link

@kornelski Could you link to the issue/pr in rustwasm/wasm-bindgen that tracked the fix for this? Also would be nice to document what the "next version" is? is it v2.0.97?

I'm trying to use the patch you suggested and getting an error

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasm-bindgen-macro-0.2.96/src/lib.rs:4:5
  |
4 |     feature(allow_internal_unstable),

so assuming I need to build nightly, however I'm also not able to get cargo update to use the patch...

    Updating crates.io index
warning: Patch `wasm-bindgen v0.2.97 (https://github.com/rustwasm/wasm-bindgen#7fa2afab)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.

@jakeswenson
Copy link

I guess wasm-bindgen-macro now fails to build without resolver = "2" see rustwasm/wasm-bindgen/issues/4304.
Maybe there should be a second issue to update the worker-rs templates to use resolver v2.

Adding this fixed the above build failure for me.

@jakeswenson
Copy link

v0.2.97 was released 8 hours ago and seems to have the fix, whatever it was.

Removing the patch suggested above and running cargo update now works...

personally I would still like to know what fixed it in wasm-bindgen so they can make sure there is a regression test for this issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants