Condvar wait not supported

I’m trying to execute cross-canister calls from within a function that I cannot make async. I am using the futures crate to do this. futures::executor::block_on works just fine if I call my own async functions, but when I try to call ic_cdk::api::call::call I get this error:

[Canister rrkah-fqaaa-aaaaa-aaaaq-cai] Panicked at 'condvar wait not supported', library/std/src/sys/wasm/../unsupported/condvar.rs:23:9

Here’s an example of the call I am trying to make (this is within a function that cannot be made async):

let string = futures::executor::block_on(async {
    let call_result: Result<(String,), _> = ic_cdk::api::call::call(
        ic_cdk::export::Principal::from_text("ryjl3-tyaaa-aaaaa-aaaba-cai").unwrap(),
        "testString",
        ()
    ).await;

    return call_result.unwrap().0;
});

I’ve narrowed things down to…well, I really think there’s an issue in the ic-cdk futures implementation somehow. I don’t yet understand Rust futures super well, but my own async functions work just fine, so I assume there is an issue with the futures that ic-cdk functions are using.

2 Likes