Compiling ic-agent v0.39.1
error[E0433]: failed to resolve: use of undeclared crate or module `tokio`
--> /Users/ahmed/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-agent-0.39.1/src/util.rs:8:5
|
8 | tokio::time::sleep(d).await;
| ^^^^^ use of undeclared crate or module `tokio`
error[E0080]: evaluation of constant value failed
--> /Users/ahmed/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-agent-0.39.1/src/util.rs:23:11
|
23 | { panic!("Using ic-agent from WASM requires enabling the `wasm-bindgen` feature") };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Using ic-agent from WASM requires enabling the `wasm-bindgen` feature', /Users/ahmed/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-agent-0.39.1/src/util.rs:23:11
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> /Users/ahmed/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-agent-0.39.1/src/agent/http_transport/reqwest_transport.rs:28:47
|
28 | pub fn create<U: Into<String>>(url: U) -> Result<Self, AgentError> {
| ------ ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<ReqwestTransport, AgentError>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected enum `Result<ReqwestTransport, AgentError>`
found unit type `()`
error[E0308]: mismatched types
--> /Users/ahmed/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-agent-0.39.1/src/agent/mod.rs:187:61
|
187 | client: config.client.unwrap_or_else(|| {
| _____________________________________________________________^
188 | | #[cfg(not(target_family = "wasm"))]
189 | | {
190 | | Client::builder()
... |
199 | | }
200 | | }),
| |_____________________^ expected `Client`, found `()`
error[E0433]: failed to resolve: use of undeclared crate or module `tokio`
--> /Users/ahmed/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-agent-0.39.1/src/util.rs:33:5
|
33 | tokio::spawn(f);
| ^^^^^ use of undeclared crate or module `tokio`
As the error message states:
Using ic-agent from WASM requires enabling the
wasm-bindgen
feature
If you are trying to use ic-agent in a Rust-based browser frontend, you must enable the wasm-bindgen
feature. If you are developing a canister, then you must not use the agent in a canister, and instead should make canister calls using the ic-cdk
API.
1 Like
I added ic-agent = { version = "0.39.1", default-features = false, features = ["wasm-bindgen"] }
to cargo.toml
and I got this
If you search the forum for __wbindgen_describe
you’ll find a bunch of threads of the same issue. Long story short some of your dependencies are trying to do things that wasm can’t do
2 Likes
This error message seems to indicate that you are using the agent in a canister. As I said:
1 Like