Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

When using CF Workers + JS, I was able

When using CF Workers + JS, I was able to stream large files out of a worker without hitting CPU limits via a ReadableStream. I'm now trying to do something similar via CF Workers + Rust and am having no such luck. As a shot in the dark, is there anything obvious that I'm doing wrong here? ```rs use console_error_panic_hook; use futures_util::TryStreamExt;...

Pull requests · cloudflare/workers-rs

Really appreciate your post Dan. I think the https://github.com/cloudflare/workers-rs/pulls 54 open Pull requests would be a great place to start, and I know there has already been some movement there, and I'm thankful. That said with the lack of development I've taken to just building my own bindings and at this point, not sure how to proceed. RUST + wasm-bindgen + workers is an amazing architecture and I'm 100% in and already completed multiple contracts with this and customers are very satisfied with the results.
One specific place outside of the PRs, I've seen people mention, is there is not an integrated deployment for pushing workers-rs to Cloudflare through the CI/CD pipeline. I had to hack my own solution together and it's pretty slow. Even tried to get the build caching to work but failed, and you only have so much room in the build commands. So getting workers-rs a first class citizen on the CI/CI pipeline would be something that would be great, especially if it improved deployment speed and cut down on my build CPU costs. 🙂...

ok well,

ok well, i am very sorry, i am not smart enough for this. ( i barely even understand WASM, so now i am just extra confused. ) ...

D1 Issues

called `Result::unwrap()` on an `Err` value: Error(JsValue(Error:
invalid type: floating point `2.0`, expected a string
Error: invalid type: floating point `2.0`, expected a string
called `Result::unwrap()` on an `Err` value: Error(JsValue(Error:
invalid type: floating point `2.0`, expected a string
Error: invalid type: floating point `2.0`, expected a string
...

Hi everyone,

Hi everyone, I'm trying to test the following code using Miniflare. However, I'm encountering the following error when I run the test: ```shell...

worker version is latest, http feature

worker version is latest, http feature is enabled, as I motioned before that url() method is return url::Url type, why compiler lookup worker::Url I'm confused.

What's the standard way to serve static

What's the standard way to serve static assets from a Rust SSR application? If I have a directory structure like this: - assets - favicon.ico - logo.png...

I tried this for the Rate Limiting API,

I tried this for the Rate Limiting API, but identifying the method signatures to add to the EnvBinding blocked me - maybe I was just looking in the wrong place, but I couldn't get it by referencing existing EnvBindings and the docs for the Typescript version.

Send/Sync and async in Workers

I've been trying to use async with workers and it's becoming an ever greater problem 😅. I wanted to see if anyone has thoughts on how to solve this problem other than forever trying to play wackamole and use workarounds. Relatively simple example: I'd like to be able to define async blocks in a bigger function to do a few things in 'parallel', the 'easiest' way to do this is with something like BoxFuture where I pin the individual async blocks and put them in a FuturesUnordered<BoxFuture<'_, Result<()>>> except this doesn't work because - Bucket is not Sync/Send - ok, easy to fix, but annoying that I have to do this and indicative of the larger problem - Rc<RefCell<wasm_bindgen_futures::Inner>> is not Sync/Send - much more difficult to fix since I'd have to rewrite a bunch of the API...

OTel Rust worker

How do I set up open telemetry for my Rusty worker? I found an sdk and some guides to do it for a JS worker but how do you do this for Rust?

Leptos SSR app

Has anyone tried to run a leptos SSR app from a worker or from pages? It seems easy enough to run the server side code from a worker but how do you include static files like css?

workers-rs repo RA feature detection

Does anyone else have the problem that rust-analyzer doesn't properly detect the enabled features in the examples in the workers-rs repo?

axum/examples/tracing-aka-logging/src/ma...

Thanks. I'm trying to get this working combined with the tracing example in the axum repo https://github.com/tokio-rs/axum/blob/main/examples/tracing-aka-logging/src/main.rs When I add TraceLayer::new_for_http() to my router I get a runtime panic saying time not implemented on this platform. Makes sense of course but I wonder if we can get that working some other way....

opened a PR to allow native web_sys

opened a PR to allow native web_sys request, without having to ditch the event macro: https://github.com/cloudflare/workers-rs/pull/525

http w/o axum

Alright, got it working: ```rust use http::{Response, StatusCode}; use worker::{event, Context, Env, HttpRequest}; ...

@kflansburg is there a specific reason

@kflansburg is there a specific reason you removed this re-export in PR 481?
pub use crate::schedule::*;
pub use crate::schedule::*;
...

Calling async code in sync trait

you can't turn async into sync in JS[1], but you can turn sync into async. I think what @kflansburg is poking around is that maybe you can think of a creative way to work around the type limitations of the trait in Rust, to turn it into some async thing you can use (or a sync thing you can poll).... but it's hard to see exactly what that would look like without seeing all the limitations you're facing. afaict this is not too far away from my channels solution above (which also turns sync+async into simple async in pure rust), and you're ultimately stuck from any of these ideas because you're somehow completely constrained by not having any async call-site where you can handle things. [1] in other words, you can turn "something that happens now" into "something that happens in the future" by delaying it, but it's logically impossible to turn "something that happens in the future" into "something that happens now". The best you can do is "keep looping now, don't move forward, until that future event happens, just loop until we get to the future" - but you can't do that either because it's not really about time, it's about driving the process forward- and by looping you prevent that progress from being made (it's just stuck in the loop, nothing else can happen). The way around that is to put the thread to sleep so that progress can be made while you loop, but the workers environment disables the ability to do this for security reasons. So, all in all, there is no way at all to turn async into sync in the workers environment, as long as those security restrictions are in place....
Next