Closed
Description
Hey there, I have the following module that tries to implement a handler function for export
wit_bindgen_rust::export!("../../wit/ephemeral/wasi-ce.wit");
use wasi_ce::*;
use cloudevents::{Event, AttributesReader};
struct WasiCe {}
impl wasi_ce::WasiCe for WasiCe {
fn ce_handler(event: String) -> Result<String,Error> {
let event_: Event = serde_json::from_str(event.as_str()).unwrap();
println!("event id: {}", event_.id());
Ok(event)
}
}
It uses the cloudevents-sdk to deserialize the argument to a struct.
The wit file is extremely simple, just contains one handler function:
ce-handler: function(event: string) -> expected<string, error>
I am using the wit-bindgen
tool for high level interface types.
After I compiled the program to wasm module using cargo build --target wasm32-wasi --release
, and then I tried to run this wasm module in the wasmtime
host (in python), and it outputs this runtime error:
Traceback (most recent call last):
File "/Users/mossaka/Developer/wasi-experimental-toolkit/tests/host_py.py", line 43, in <module>
run(event)
File "/Users/mossaka/Developer/wasi-experimental-toolkit/tests/host_py.py", line 24, in run
wasm = WasiCe(store, linker, module)
File "/Users/mossaka/Developer/wasi-experimental-toolkit/tests/bindings.py", line 73, in __init__
self.instance = linker.instantiate(store, module)
File "/usr/local/Caskroom/miniconda/base/envs/myenv/lib/python3.9/site-packages/wasmtime/_linker.py", line 165, in instantiate
raise WasmtimeError._from_ptr(error)
wasmtime._error.WasmtimeError: unknown import: `__wbindgen_placeholder__::__wbindgen_describe` has not been defined
Any suggestions on how to understand this error message and hints on solve would be greatly appreciated!
Metadata
Metadata
Assignees
Labels
No labels