clockworklabs/SpacetimeDB · error · anyhow::Error
procedure_http_request is only available in async instances
Error message
procedure_http_request is only available in async instances
What it means
Same mechanism as the sleep stub: the wasmtime host links async-only imports (here spacetimedb's HTTP request procedure) to stubs that always fail when called from a synchronous instance. procedure_http_request needs an async instance (network I/O requires the host's async support), so a module invoking it in sync mode gets this error from the stub at call time.
Solutions
- Rebuild the module with the spacetimedb crate version matching the server (cargo update / Cargo.toml pin), then `cargo clean && spacetime build`
- Republish the rebuilt module
- Keep SDK and server versions locked together in your toolchain
- If you don't need outbound HTTP, remove the call so the import is not generated
Example fix
# before: stale module calls spacetimedb_http_request in a sync instance # after: rebuild with the SDK matching the server, republish $ cargo update -p spacetimedb --precise <server-version> $ cargo clean && spacetime build && spacetime publish my-db
Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash
# fail if SDK and server versions drift
sdk=$(grep -A1 'spacetimedb =' Cargo.toml | grep -o '"[^"]*"' | tr -d '"' | head -1)
[ "$sdk" = "$SPACETIMEDB_VERSION" ] \
|| { echo "SDK $sdk != server $SPACETIMEDB_VERSION - rebuild module" >&2; exit 1; } Prevention
- Keep SDK and server versions in lockstep in CI
- Rebuild and republish modules after any server upgrade before exercising HTTP features
- Remove unused outbound-HTTP call sites so the import is never generated
- Version-stamp built artifacts so stale .wasm files are detectable
When it happens
Trigger: A module performing host-side HTTP requests (e.g. via the SDK's HTTP API) but instantiated in sync mode -- typically after upgrading only one of the SDK or server, so the module's ABI and the instance mode disagree.
Common situations: Calling out to external APIs from a reducer built with a mismatched SDK version; publishing an old artifact to an upgraded server; local dev server older than the crate used to build.
Related errors
- procedure_sleep_until is only available in async instances
- export is a function with incorrect type
- export is a function with incorrect type
- export is a function with incorrect type
- export is a function with incorrect type
AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-08-20).
Data as JSON: /api/errors/0261ff4f6fc4c690.
Report an issue: GitHub.
Appendix: source
Thrown at crates/core/src/host/wasmtime/wasmtime_module.rs:141
}
_ => anyhow::bail!("missing sync Wasmtime stub for async ABI import `{module}::{name}`"),
}
Ok(())
}
fn procedure_sleep_until_sync_stub(_: Caller<'_, WasmInstanceEnv>, _: i64) -> anyhow::Result<i64> {
anyhow::bail!("procedure_sleep_until is only available in async instances")
}
fn procedure_http_request_sync_stub(
_: Caller<'_, WasmInstanceEnv>,
_: u32,
_: u32,
_: u32,
_: u32,
_: u32,
) -> anyhow::Result<u32> {
anyhow::bail!("procedure_http_request is only available in async instances")
}
macro_rules! impl_wasmtime_module {
($module:ty) => {
impl module_host_actor::WasmModule for $module {
type Instance = WasmtimeInstance;
type InstancePre = Self;
type ExternType = ExternType;
fn get_export(&self, s: &str) -> Option<Self::ExternType> {
self.module
.module()
.exports()
.find(|exp| exp.name() == s)
.map(|exp| exp.ty())
}
fn for_each_export<E>(&self, mut f: impl FnMut(&str, &Self::ExternType) -> Result<(), E>) -> Result<(), E> {View on GitHub (pinned to eddf9f5014)