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

Deploying to Cloudflare Workers? #847

Open
maxcountryman opened this issue Sep 9, 2021 · 1 comment
Open

Deploying to Cloudflare Workers? #847

maxcountryman opened this issue Sep 9, 2021 · 1 comment

Comments

@maxcountryman
Copy link

Hi folks, with the news that Cloudflare Workers now supports Rust directly I'm curious what would be required to deploy a Tide app to this surface?

I believe there's some prior art involving AWS Lambda but I'm not sure if that's applicable here.

@extraymond
Copy link

@maxcountryman

It can work as long as you disable sse and tcp_listener module, which used task::spawn which is not available on wasm platform for async-std.

You can use the tide::Server::respond method to convert from worker::Request and into worker::Response.
One thing you might be careful is that the worker::Request take js_sys::Uint8Array as body input, so you need to serde_json::to_vec, convert vec![] to Uint8Array and convert array into JsValue so that it can send to other worker endpoints, such as durable_object.

my demo repo
As you can see, I get it working for both worker and durable-object which both are powered by tide and async-graphql.

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