I'm working on updating some of our tests from wasmtime 17 to wasmtime 38 (we're on MSRV 1.88 so can't make it to 40 quite yet). I am getting the error:
thread 'tokio-runtime-worker' panicked at /Users/lnj/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasmtime-38.0.4/src/runtime/component/func/typed.rs:160:9:
must use `call_async` when async support is enabled on the config
I'm basing everything on this example and what I am doing looks similar:
// Create a Wasmtime Engine configured to run Components
let engine = Engine::new(
wasmtime::Config::new()
.wasm_component_model(true)
.async_support(true),
)?;
// Create a Wasmtime Engine configured to run Components
let engine = Engine::new(
wasmtime::Config::new()
.wasm_component_model(true)
.async_support(true),
)?;
// Create our component from the wasm file
let component = Component::from_file(&engine, wasm_bin_path)?;
// Create the linker and link in the necessary WASI bindings
let mut linker = Linker::new(&engine);
wasmtime_wasi::p2::add_to_linker_async(&mut linker)?;
wasmtime_wasi_http::add_only_http_to_linker_async(&mut linker)?;
// Configure and create a `WasiCtx`, which WASI functions need access to
// through the host state of the store
let wasi_ctx = WasiCtxBuilder::new()
.inherit_stderr()
.inherit_stdout()
.build();
let host_ctx = WasiHostCtx {
preview2_ctx: wasi_ctx,
preview2_table: wasmtime_wasi::ResourceTable::new(),
wasi_http_ctx: wasmtime_wasi_http::WasiHttpCtx::new(),
};
let mut store: Store<WasiHostCtx> = Store::new(&engine, host_ctx);
// Instantiate our module with the bindgen! bindings
let bindings = CanaryWorld::instantiate_async(&mut store, &component, &linker).await?;
let canary_interface = bindings.aws_component_canary_interface();
let api_result = canary_interface
.call_run_canary(store)?
.map_err(anyhow::Error::msg)?;
The example isn't doing an explicit call_async, so I'm probably missing something in the setup, but comparing to the example I'm not seeing it. call_run_canary doesn't return a Future so not sure where the mistake is.
I think you might need to use the configuration options to the bindgen! macro which is generating CanaryWorld to specify that the export is async, and that'll generate async bindings which appropriately use call_async under the hood
That seems to have done the trick. I had async: true in bindgen! on 17, but missed that it had moved to the exports section in the newer version. Thank you!
Last updated: Jan 29 2026 at 13:25 UTC