fermyon / leptos-spin

Integration library for running server-side Leptos apps on Spin
27 stars 6 forks source link

adding tonic on cargo.toml wont build #39

Open codeitlikemiley opened 3 weeks ago

codeitlikemiley commented 3 weeks ago

I tried to build a normal leptos app

and consume a grpc service

it works ...

so I headed on testing it with leptos-spin

i added this on Cargo.toml

[dependencies]
...
tonic = {version = "0.11.0", optional = true}

[features]
...
ssr = [
   ...
  "dep:tonic",
]
Output of `spin build`
https://gist.github.com/codeitlikemiley/97c162babfba3ceeed2cdd92c229a6eb

I guess any grpc related stuff cannot be invoke on any spin instance?

itowlson commented 3 weeks ago

Thanks for sharing the output - this makes it waaay easier to investigate and I appreciate you taking the time.

compile_error!("Only features sync,macros,io-util,rt,time are supported on wasm.")

It looks like tonic depends on tokio, and unfortunately tokio does not yet support compiling to Wasm. (Well, not enough of tokio, anyway...) Sorry, I'm not aware of a workaround at this stage, although hopefully it will improve as the Rust wasip2 target comes on stream, and as WASI 0.3 (with async) stabilises.

codeitlikemiley commented 3 weeks ago

Im currently researching it on using on wasm, i found a good resource https://github.com/devashishdxt/tonic-web-wasm-client/tree/tls/test-suite/client

i would post it back here if i manage to make it work