Here is the error I’m seeing when I add ic-agent to a Axum project:
The intent is to be able to call into the IC as a data layer from an off-chain server.
Here is a minimal reproduction:
Thoughts?
Here is the error I’m seeing when I add ic-agent to a Axum project:
The intent is to be able to call into the IC as a data layer from an off-chain server.
Here is a minimal reproduction:
Thoughts?
Just checked the source code here.
We have conditional compilation for the match pattern Some(duration)
:
wasm
wasm
AND the wasm-bindgen
feature is onThere can be a case that is not covered: the target is wasm
AND the wasm-bindgen
feature is off.
Are you embedding Rust agent in Wasm? If so, turning on wasm-bindgen
feature should make it work.
P.S. IMO, this is indeed a Rust agent issue. It should compile for wasm when the feature is off.
For the above error, I just added the crate to a Leptos project.
I haven’t imported/added any use
statements for the error to show up.
I’m not completely sure about this
From what I’m aware, Leptos compiles to 2 different outputs, an Axum server binary that is run on the server and performs SSR and another WASM bundle that is used when hydrating on the client browser and takes over interactivity. The agent will be used in both places is what I intend to do to fetch data from the IC and prerender pages on the server and serve to clients for fast initial page loads and then use the agent for further data loading on the client for subsequent interactivity
Here’s some more context from the Leptos repo
When building with cargo-leptos, the frontend, library package, is compiled into wasm using target
wasm-unknown-unknown
and the features--no-default-features --features=hydrate
The server binary is compiled with the features--no-default-features --features=ssr
The cargo build parameters look something like this when building:
Let me know if that was helpful or if there’s any more context I can provide
In your Cargo.toml
, change the line of ic-agent
into:
ic-agent = { version = "0.30.0", features = ["wasm-bindgen"] }
Yes, I believe that worked. Thank you so much