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

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....

V0.0.22

@kflansburg just out of curiosity, are there any more changes you want to have merged before cutting a new release?

D1PreparedStatement API

the conversion from D1Type -> JsValue is done once per item per row, which means that every time you call bind_refs, all the D1Types have to be converted. Say we have 4 things we want to bind, and 2 are static, this means that every time we are passing all 4 to js and back. If we're clever with our iterator and are able to use jsvalue, we can instead always return the same 2 references to the static jsvalues and and only convert the 2 dynamic ones every bind_refs...

How to send `FormData` via `Fetch`? I

How to send FormData via Fetch? I don't see Into<JsValue> implementation on the FormData struct.

Yeah had a few problems with the smart

Yeah had a few problems with the smart pointers a while ago as well. But I'll give it another go. My problem right now though is that I can't call self from within the event handler.

GitHub - rasviitanen/rustysignal: Signal...

Hey guys trying to build a Signalling Server with Rust based on this repo: https://github.com/rasviitanen/rustysignal/tree/master Facing some issues when accounting for worker-rs instead. ...
Next