Module imports function '__wbindgen_describe' from '__wbindgen_placeholder__' that is not exported by the runtime

The error comes from the js feature of getrandom crate.

The js feature assumes that the target platform is a web browser which containing a JavaScript engine.

This is not true for the IC Wasm Runtime. To get randomness within a Canister, you should use the official API: raw_rand in ic_cdk::api::management_canister::main - Rust

If you have some dependencies rely on getrandom, you can turn on the custom feature of it and implement dummy getrandom hook to make it compile.

Here is an example of how to do it.

8 Likes