I tried this way, but the canister seems to have difficulties serialise the [u8; 16]
, I also tried to use the Uuid
package and the canister failed even when I just use Uuid::preload::*;
#[update]
#[candid_method(update)]
pub async fn test_create_id() -> String {
let id: ([u8; 16], ) = ic_cdk::api::call::call(
ic_cdk::export::Principal::management_canister(),
"raw_rand",
(),
).await.unwrap(); //<---- it is Panicking here?
return format!("{:#?}", id)
}
[Canister rrkah-fqaaa-aaaaa-aaaaq-cai] Panicked at 'called `Result::unwrap()` on an `Err` value: (CanisterError, "failed to decode canister response as (): Trailing value after finishing deserialization")', canisters/backend/src/files/update.rs:73:34
[Canister rrkah-fqaaa-aaaaa-aaaaq-cai] Panicked at 'called `Result::unwrap()` on an `Err` value: (NoError, "cleanup")', canisters/backend/src/files/update.rs:73:34
Maybe there are other ways to generate Uuid
s?