Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding tonic on cargo.toml wont build #39

Open
codeitlikemiley opened this issue Jun 13, 2024 · 4 comments
Open

adding tonic on cargo.toml wont build #39

codeitlikemiley opened this issue Jun 13, 2024 · 4 comments

Comments

@codeitlikemiley
Copy link

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
Copy link
Collaborator

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
Copy link
Author

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

@codeitlikemiley
Copy link
Author

@itowlson after some experimentation, i never got it to work ...

@itowlson
Copy link
Collaborator

itowlson commented Jul 8, 2024

@codeitlikemiley Ugh, that's frustrating. Thanks for letting us know - hopefully this will improve as the Wasm ecosystem does (and perhaps as WASI 0.3 becomes available).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants