briansmith / ring

Safe, fast, small crypto using Rust
Other
3.77k stars 708 forks source link

`function import requires a callable` LinkError error with Cloudflare workers WASM #2155

Closed pawurb closed 2 weeks ago

pawurb commented 1 month ago

Hi. I'm trying to use the project with Cloudflare Rust workers. I can compile using a custom target and wasm32_unknown_unknown_js flag. But adding any import results in:

Uncaught LinkError: WebAssembly.Instance(): Import cloudflare/workers-sdk#9 "./index_bg.js" "__wbg_error_53abcd6a461f73d8": function import requires a callable

    at null.<anonymous> (shim.js:41:9)

✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above

when running npx wrangler dev

I've recreated the issue here: https://github.com/pawurb/ring-wasm-test . Any tips how to resolve it will be appreciated.

agustfricke commented 1 month ago

With Rust version 1.82.0, I was getting the same error. Just downgrade Rust to version 1.81.0, which works. You can do this with the command: rustup install 1.81.0, rustup default 1.81.0. https://github.com/cloudflare/workers-rs/issues/668, Regards!

pawurb commented 1 month ago

@agustfricke thanks, but i'm getting the same error on 1.80, 1.81, and 1.82 . I'm using a bunch of crates in my cf-workers project, and so far ring is the only one triggering this bug.

aN4ksaL4y commented 3 weeks ago

faced the same error, and then install as @agustfricke suggested. and seems working.

Meowu commented 2 weeks ago

Same issue. It works with 1.81.0