Hi! I have a canister, which performs some logic. So I need create another canister instance in runtime. What I am doing.
- Getting wasm code of current canister
- Perform call for canister creation where controllers same as, controllers of current canister
let create_res = create_canister(
CreateCanisterArgument {
settings: Some(CanisterSettings {
controllers: Some(ctls),
compute_allocation: None,
memory_allocation: None,
freezing_threshold: None,
reserved_cycles_limit: None,
}),
},
15_000_000_000,
)
- Passing arguments, wasm and controllers to the install_wasm method
let arg = InstallCodeArgument {
mode: CanisterInstallMode::Install,
canister_id: cnstr,
wasm_module: wasm_vec.clone(),
arg: argument,
};
let res = install_code(arg).await;
So, canister successfually creates and works. But, when I am trying to navigate to this canister via candid interface 127.0.0.1:4943/?canisterId=bd3sg-teaaa-aaaaa-qaaba-cai&id=b77ix-eeaaa-aaaaa-qaada-cai where b77ix-eeaaa-aaaaa-qaada-cai is id of recently created canister, I receive following error
An error happened in Candid canister:
Error: Cannot fetch candid file
at fetchActor (127.0.0.1:4943/index.js:2:319660)
at async 127.0.0.1:4943/index.js:2:329683
How can I pass did file to newly created canister? Or, probably I need to recompile wasm correctly. Should wasm contain did file?