-
Notifications
You must be signed in to change notification settings - Fork 256
Open
Description
Summary
Using wit-bindgen (crate 0.51.0) to generate a wasi:http/service@0.3.0-rc-2026-01-06 component produces a valid component (wasm-tools validate passes), but the generated import shape appears incompatible with wasmtime serve.
Related wasmtime issue: bytecodealliance/wasmtime#12714
Versions
- wit-bindgen crate:
0.51.0 - rustc:
1.92.0 - wasm-tools:
1.245.1 - wasmtime:
41.0.3
Repro
src/lib.rs:
wit_bindgen::generate!({
inline: r#"
package vibe:http-adapter;
world serviceonly {
include wasi:http/service@0.3.0-rc-2026-01-06;
}
"#,
path: "<wasmtime repo>/crates/wasi-http/src/p3/wit",
world: "vibe:http-adapter/serviceonly",
pub_export_macro: true,
generate_all,
});
use exports::wasi::http::handler::Guest;
use wasi::http::types::{ErrorCode, Request, Response};
struct Component;
impl Guest for Component {
async fn handle(request: Request) -> Result<Response, ErrorCode> {
let _ = request;
Err(ErrorCode::InternalError(None))
}
}
export!(Component);cargo build --target wasm32-unknown-unknown --release
wasm-tools component new target/wasm32-unknown-unknown/release/<crate>.wasm -o service_only.component.wasm
wasm-tools component wit service_only.component.wasm > service_only.witGenerated service_only.wit starts as:
package root:component;
world root {
import wasi:http/types@0.3.0-rc-2026-01-06;
export wasi:http/handler@0.3.0-rc-2026-01-06;
}
package wasi:http@0.3.0-rc-2026-01-06 {
interface types {
resource request;
resource response;
...Then wasmtime serve fails:
instance export `request` has the wrong type
resource implementation is missing
Question
Is this import/type shape expected from wit-bindgen for P3 wasi:http/service, or should wit-bindgen preserve a fuller types resource shape so hosts can link canonical wasi:http/types implementations?
If this is expected behavior, is there a recommended generation mode/flag to avoid this incompatibility?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels