profitgrowinginnovator added the bug label to Issue #10168.
profitgrowinginnovator opened issue #10168:
Test Case
The wit file:
package sasync:guest; interface string-if { resource string-rs { /// Returns the name of the SaaS provider string-fn: func() -> string; } } world string-guest { export string-if; }
main.rs:
`use bindings::exports::sasync::guest::string_if::{Guest, GuestStringRs};
use wit_bindgen::generate;mod bindings {
wit_bindgen::generate!({
path: "./wit/async-string.wit",
world: "string-guest",
async: true,
});use super::AsyncString; export!(AsyncString);
}
pub struct AsyncString;
// :check: Implement
GuestStringRs
forAsyncString
impl GuestStringRs for AsyncString {
async fn string_fn(&self) -> String { "success".to_string() }
}
impl Guest for AsyncString {
type StringRs = AsyncString;
}fn main() {
println!("WASM executed successfully!");
}`
Steps to Reproduce
- cargo build --target wasm32-wasip2
- wasmtime run target/wasm32-wasip2/debug/async-string.wasm
Expected Results
WASM executed successfully! [This is what happens when async: false and async removed from fn string_fn]
Actual Results
Error: failed to parse WebAssembly module
Caused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)Versions and Environment
Wasmtime version or commit:
wit-bindgen = { version= "0.38.0", features = ["async"] }
wit-bindgen-rt = { version = "0.38.0", features = ["async"] }Operating system: MacOS
Architecture: Arm
Extra Info
Here is a github with all the code:
https://github.com/profitgrowinginnovator/async-stringSimilar module error is launched when an async wasm is read:
Error: failed to parse WebAssembly moduleCaused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)#[tokio::main] // Requires the "macros" feature
async fn main() -> anyhow::Result<()> {
let mut config = Config::new();
config.wasm_component_model(true);
config.async_support(true); // Enable async support
let engine = Engine::new(&config)?;
//let mut linker = Linker::<MyState>::new(&engine);let state = MyString::default(); let mut store = Store::new(&engine, state); let linker = Linker::new(&engine); let component = Component::from_file(&engine, "../async-string/target/wasm32-wasip2/debug/async-string.wasm")?; let command = Command::instantiate_async(&mut store, &component, &linker).await?; let result = command.wasi_cli_run().call_run(store); println!("Result from WASM: {:?}", result.await); Ok(())
}
profitgrowinginnovator edited issue #10168:
Test Case
The wit file:
package sasync:guest; interface string-if { resource string-rs { /// Returns the name of the SaaS provider string-fn: func() -> string; } } world string-guest { export string-if; }
use bindings::exports::sasync::guest::string_if::{Guest, GuestStringRs}; use wit_bindgen::generate; mod bindings { wit_bindgen::generate!({ path: "./wit/async-string.wit", world: "string-guest", async: true, }); use super::AsyncString; export!(AsyncString); } pub struct AsyncString; // ✅ Implement `GuestStringRs` for `AsyncString` impl GuestStringRs for AsyncString { async fn string_fn(&self) -> String { "success".to_string() } } impl Guest for AsyncString { type StringRs = AsyncString; } fn main() { println!("WASM executed successfully!"); }``` ### Steps to Reproduce * cargo build --target wasm32-wasip2 * wasmtime run target/wasm32-wasip2/debug/async-string.wasm ### Expected Results WASM executed successfully! [This is what happens when async: false and async removed from fn string_fn] ### Actual Results Error: failed to parse WebAssembly module Caused by: invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e) ### Versions and Environment Wasmtime version or commit: wit-bindgen = { version= "0.38.0", features = ["async"] } wit-bindgen-rt = { version = "0.38.0", features = ["async"] } Operating system: MacOS Architecture: Arm ### Extra Info Here is a github with all the code: https://github.com/profitgrowinginnovator/async-string Similar module error is launched when an async wasm is read: Error: failed to parse WebAssembly module Caused by: invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e) #[tokio::main] // Requires the "macros" feature async fn main() -> anyhow::Result<()> { let mut config = Config::new(); config.wasm_component_model(true); config.async_support(true); // Enable async support let engine = Engine::new(&config)?; //let mut linker = Linker::<MyState>::new(&engine); let state = MyString::default(); let mut store = Store::new(&engine, state); let linker = Linker::new(&engine); let component = Component::from_file(&engine, "../async-string/target/wasm32-wasip2/debug/async-string.wasm")?; let command = Command::instantiate_async(&mut store, &component, &linker).await?; let result = command.wasi_cli_run().call_run(store); println!("Result from WASM: {:?}", result.await); Ok(()) } ~~~
profitgrowinginnovator edited issue #10168:
Test Case
The wit file:
package sasync:guest; interface string-if { resource string-rs { /// Returns the name of the SaaS provider string-fn: func() -> string; } } world string-guest { export string-if; }
use bindings::exports::sasync::guest::string_if::{Guest, GuestStringRs}; use wit_bindgen::generate; mod bindings { wit_bindgen::generate!({ path: "./wit/async-string.wit", world: "string-guest", async: true, }); use super::AsyncString; export!(AsyncString); } pub struct AsyncString; // ✅ Implement `GuestStringRs` for `AsyncString` impl GuestStringRs for AsyncString { async fn string_fn(&self) -> String { "success".to_string() } } impl Guest for AsyncString { type StringRs = AsyncString; } fn main() { println!("WASM executed successfully!"); }
Steps to Reproduce
- cargo build --target wasm32-wasip2
- wasmtime run target/wasm32-wasip2/debug/async-string.wasm
Expected Results
WASM executed successfully! [This is what happens when async: false and async removed from fn string_fn]
Actual Results
Error: failed to parse WebAssembly module
Caused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)Versions and Environment
Wasmtime version or commit:
wit-bindgen = { version= "0.38.0", features = ["async"] }
wit-bindgen-rt = { version = "0.38.0", features = ["async"] }Operating system: MacOS
Architecture: Arm
Extra Info
Here is a github with all the code:
https://github.com/profitgrowinginnovator/async-stringSimilar module error is launched when an async wasm is read:
Error: failed to parse WebAssembly moduleCaused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)#[tokio::main] // Requires the "macros" feature
async fn main() -> anyhow::Result<()> {
let mut config = Config::new();
config.wasm_component_model(true);
config.async_support(true); // Enable async support
let engine = Engine::new(&config)?;
//let mut linker = Linker::<MyState>::new(&engine);let state = MyString::default(); let mut store = Store::new(&engine, state); let linker = Linker::new(&engine); let component = Component::from_file(&engine, "../async-string/target/wasm32-wasip2/debug/async-string.wasm")?; let command = Command::instantiate_async(&mut store, &component, &linker).await?; let result = command.wasi_cli_run().call_run(store); println!("Result from WASM: {:?}", result.await); Ok(())
}
profitgrowinginnovator edited issue #10168:
Test Case
The wit file:
package sasync:guest; interface string-if { resource string-rs { /// Returns the name of the SaaS provider string-fn: func() -> string; } } world string-guest { export string-if; }
use bindings::exports::sasync::guest::string_if::{Guest, GuestStringRs}; use wit_bindgen::generate; mod bindings { wit_bindgen::generate!({ path: "./wit/async-string.wit", world: "string-guest", async: true, }); use super::AsyncString; export!(AsyncString); } pub struct AsyncString; // ✅ Implement `GuestStringRs` for `AsyncString` impl GuestStringRs for AsyncString { async fn string_fn(&self) -> String { "success".to_string() } } impl Guest for AsyncString { type StringRs = AsyncString; } fn main() { println!("WASM executed successfully!"); }
Steps to Reproduce
- cargo build --target wasm32-wasip2
- wasmtime run target/wasm32-wasip2/debug/async-string.wasm
Expected Results
WASM executed successfully! [This is what happens when async: false and async removed from fn string_fn]
Actual Results
Error: failed to parse WebAssembly module
Caused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)Versions and Environment
Wasmtime version or commit:
wit-bindgen = { version= "0.38.0", features = ["async"] }
wit-bindgen-rt = { version = "0.38.0", features = ["async"] }Operating system: MacOS
Architecture: Arm
Extra Info
Here is a github with all the code:
https://github.com/profitgrowinginnovator/async-stringSimilar module error is launched when an async wasm is read:
Error: failed to parse WebAssembly moduleCaused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)#[tokio::main] // Requires the "macros" feature async fn main() -> anyhow::Result<()> { let mut config = Config::new(); config.wasm_component_model(true); config.async_support(true); // Enable async support let engine = Engine::new(&config)?; //let mut linker = Linker::<MyState>::new(&engine); let state = MyString::default(); let mut store = Store::new(&engine, state); let linker = Linker::new(&engine); let component = Component::from_file(&engine, "../async-string/target/wasm32-wasip2/debug/async-string.wasm")?; let command = Command::instantiate_async(&mut store, &component, &linker).await?; let result = command.wasi_cli_run().call_run(store); println!("Result from WASM: {:?}", result.await); Ok(()) }
bjorn3 commented on issue #10168:
Support for the async ABI of the component model is not yet implemented in Wasmtime as it was only recently introduced in the component model. There is an open PR to implement it: https://github.com/bytecodealliance/wasmtime/pull/9582
profitgrowinginnovator commented on issue #10168:
Thanks for letting me know. I just found out about https://github.com/bytecodealliance/wrpc Hopefully this solves it.
profitgrowinginnovator closed issue #10168:
Test Case
The wit file:
package sasync:guest; interface string-if { resource string-rs { /// Returns the name of the SaaS provider string-fn: func() -> string; } } world string-guest { export string-if; }
use bindings::exports::sasync::guest::string_if::{Guest, GuestStringRs}; use wit_bindgen::generate; mod bindings { wit_bindgen::generate!({ path: "./wit/async-string.wit", world: "string-guest", async: true, }); use super::AsyncString; export!(AsyncString); } pub struct AsyncString; // ✅ Implement `GuestStringRs` for `AsyncString` impl GuestStringRs for AsyncString { async fn string_fn(&self) -> String { "success".to_string() } } impl Guest for AsyncString { type StringRs = AsyncString; } fn main() { println!("WASM executed successfully!"); }
Steps to Reproduce
- cargo build --target wasm32-wasip2
- wasmtime run target/wasm32-wasip2/debug/async-string.wasm
Expected Results
WASM executed successfully! [This is what happens when async: false and async removed from fn string_fn]
Actual Results
Error: failed to parse WebAssembly module
Caused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)Versions and Environment
Wasmtime version or commit:
wit-bindgen = { version= "0.38.0", features = ["async"] }
wit-bindgen-rt = { version = "0.38.0", features = ["async"] }Operating system: MacOS
Architecture: Arm
Extra Info
Here is a github with all the code:
https://github.com/profitgrowinginnovator/async-stringSimilar module error is launched when an async wasm is read:
Error: failed to parse WebAssembly moduleCaused by:
invalid leading byte (0x9) for canonical function (at offset 0x3a8a7e)#[tokio::main] // Requires the "macros" feature async fn main() -> anyhow::Result<()> { let mut config = Config::new(); config.wasm_component_model(true); config.async_support(true); // Enable async support let engine = Engine::new(&config)?; //let mut linker = Linker::<MyState>::new(&engine); let state = MyString::default(); let mut store = Store::new(&engine, state); let linker = Linker::new(&engine); let component = Component::from_file(&engine, "../async-string/target/wasm32-wasip2/debug/async-string.wasm")?; let command = Command::instantiate_async(&mut store, &component, &linker).await?; let result = command.wasi_cli_run().call_run(store); println!("Result from WASM: {:?}", result.await); Ok(()) }
Last updated: Feb 28 2025 at 03:10 UTC