-
Hi there! I am wondering what is the best way to access third-party APIs from a worker such as sendgrid, gmail, stripe etc. There is a Rust crate for most of these services, however most (if not all) of these crates have a dependency on hyper and/or tokio (which will not compile to wasm). In your opinion, is it best to modify these existing Rust crates to work with Fetch or would it perhaps be better to create bindings to a Node.js module? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@allsey87 - That is a bit of an unfortunate side-effect of using a new technology. Many HTTP client crates will use Another option is to find a crate that separates the request data from the HTTP transport altogether, such as https://github.com/baschoj/sendgrid-rs Lastly, you may want to implement the requests yourself using |
Beta Was this translation helpful? Give feedback.
@allsey87 - That is a bit of an unfortunate side-effect of using a new technology. Many HTTP client crates will use
reqwest
which does have support for wasm, and its possible that the authors of the client crates for those services have hidden support behind a feature?Another option is to find a crate that separates the request data from the HTTP transport altogether, such as https://github.com/baschoj/sendgrid-rs
Lastly, you may want to implement the requests yourself using
Fetch
without any client library. It is a bit more work, but at the end of the day, you will probably have a smaller wasm binary and full control over how things work.