dfinity / cdk-rs

Rust canister development kit for the Internet Computer.
Apache License 2.0
201 stars 90 forks source link

Issue using `candid-derive` with wasm binary assets in canister #501

Closed muse254 closed 4 months ago

muse254 commented 4 months ago

I have canister code that loads a static binary asset as &[u8] at compile-time. When trying to generate the .did file I run into an issue about not finding an import. For my case the canister is meant partly as an asset store

Error: unknown import: `wapc::__guest_request` has not been defined
chenyan-dfinity commented 4 months ago

It seems one of your library imports the wapc module, which is not allowed by the IC. It's not a Candid export problem. If we try to deploy the Wasm to IC without Candid, you will probably get the same error.

muse254 commented 4 months ago

That fixed the issue. Thank you @chenyan-dfinity