I'm trying to create a Python component that makes an outbound HTTP request using a Rust host. I've gotten the component built, but it hangs when executing the outbound HTTP request. I'm guessing this is because I haven't hooked up Tokio inside my Rust host.
I've been trying to repurpose code from https://github.com/bytecodealliance/wasmtime/blob/v17.0.1/src/commands/serve.rs to make it work. My question: Does wasmtime_wasi_http have a helper function to make this work?
Haven't posted here very much, so please let me know if there's a better place for this to go.
I'm not sure what would be causing it to hang, but if you can push what you have to a public repo, I can try to debug it.
Pushed my code here (https://github.com/kyleconroy/compontentize-py-http) which shows the issue. Let me know if you can't get it to build.
Switching from async-std
to tokio
fixed it: https://github.com/kyleconroy/compontentize-py-http/pull/1. Given that wasmtime-wasi
and wasmtime-wasi-http
rely on tokio
, I doubt there's a way to make embeddings work with other executors for the time being without some extensive changes.
Thanks Joel. I'm a bit new to Rust so I wouldn't have ever caught this.
Yeah, the whole "how to I choose an async executor?" question trips everybody up.
Kyle Gray has marked this topic as resolved.
Last updated: Nov 22 2024 at 16:03 UTC