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

Queue consumers - when/when not wrap the code in `waitUntil()`?

Could someone please clarify when it is and isn't necessary/a good idea to use waitUntil() inside a queue consumer? The docs suggest using it, however queue consumers already run asynchronously, in the background (not as the result of a HTTP trigger), so unless the consumer is doing a LOT of work, and is therefore at risk of exceeding Worker limits, what's the point? My consumer receives a bunch of messages and sends an email (via an API) for each one. Traffic to this queue is low, and the settings are quite conservative: ``` "max_batch_size": 10,...

Lots of requests right after creating worker

I just created a worker and i am getting 400 requests to the eworker from London (i am not from there) and I am not using vpn or anything, So where are these req coming from? This happened with all workers i am creating....
No description

How to change the Installing tools and dependencies command and directory in worker settings?

I've already specified the directory and build commands in the dashboard. But the Installing tools and dependencies command runs in the project's root, and I don't want that. How can I fix that? Ideally, I would want to install deps in the wrangler project only...
No description

Workers route awareness at origin

Hello folks, I’m interested in seeing if anyone has done anything similar to what I’d like to achieve on Cloudflare with workers or any other Cloudflare feature set. Essentially our origin proxy has all the routes that a public domain/path will be routed towards onto its backend app that will serve that traffic. I’d like for this route awareness to be available on Cloudflare so that we can scope configurations like WAF / rate limiters etc to the particular app and its paths only. One option may be to dump the flat file with all router information onto the worker but with thousands of routes that can be wildcards etc I’m wondering if the performance penalty is just to much....

503s for >1% of http traffic bound for workers

Hey all, in HTTP Traffic Analytics for the past 30 days we’re seeing ~1.5% of requests to our worker routes return 503 (Service Unavailable), but no errors show up in Workers Observability, and we’re well under the 100k/day limit (~4k–5k/day). Logs are clean Workers return a simple HTML page if pathname matches, otherwise return fetch for the original request. 503s show up for the same URLs that work normally Can Cloudflare return 503s before the Worker runs, even under quota? What else could cause this?...

[D1] TypeError: Cannot read properties of undefined (reading 'alwaysPrimarySession')

im trying to make my worker's D1 batch have many attempts, but it refuses to run, its running on an scheduled event, and the batch runs at the very end of it, using await or ctx.waitUntil makes no difference ```ts /** * awaits a function, but with multiple attempts and wait time between attempts...

Cannot SST deploy Cloudflare Worker due to 'Cannot use import statement outside a module'

Hi, I'm trying to move the whole infrastructure deploy from OpenTofu to SST. I use Cloudflare for everything and the only issue remains with workers. This is a configuration for the worker: ``` new sst.cloudflare.Worker('userWorker', {...

latest updates to Workers?

I'm having a hard time to find info about what was added to Workers over the past year. Seems like Pages & Workers merged? Because all of the sudden the default template includes a public/index.html file without an import from the index.js. Bad thing is most AI code builders still have the old workers tech; maybe if you make breaking changes you should just rename the project instead of confusing everyone?...

Trying to migrate an Async Class to Worker

I'm working with the twitch api, and I'm trying to migrate a Class Object to cloudflare workers. Currently I'm having issues trying to resolve how the fetch handler works, and how I'm used to using fetch. Given that I use fetch several times throughout the Class Object, would i be able to just define the whole Class within the Default Export... fetch handler and have everything work there? would that even be desirable? I think I could maybe just pull all of the fetch items out and only use them within the handler, but that seems like making an issue way more complex than it needs to be. Code is available here: https://github.com/Senti3ntB3ing/cloudflare-en-passant Class in question is available in twitch_chat.js...

Issues with workers ai, redirect loop to /usage even though I don’t have an existing worker

I recently wanted to integrate AI into my site, so I go into Cloudflare Dash > AI > Choose Workers API and create it, and then I deleted it immediately because I wanted to use the Rest API, but I can’t see that screen where you choose amongst worker and rest api, it keeps redirecting me to ai/usage

Debugging cloudflare workers on Visual Studio 2022

I'm trying to debug my worker on Visual Studio 2022, I have been enabled to get it working but with some issues, I have created a post on Microsoft Developer Community about them: https://developercommunity.visualstudio.com/t/Debugging-typescript-on-VS-crashes-and-h/10897105 Has someone else tried something similar or have any suggestion/tips in how to improve this debugging experience?...

My worker's execution depends on a message from another worker - how to wait without exceeding CPU?

My worker is waiting for a Durable Object websocket message that will take a few seconds to be sent, but the worker's websocket client continues to close after 1 second. The outcome property from Worker Logs is "exceededCpu". Is there a workaround or better way to architect the execution workflow. Worker Log entry below for reference. "$workers": { "truncated": false, "event": {...

Scheduled Worker - Unexpected 429s

Hi, we're having an issue with cron scheduled worker invocations (scheduled()) where some of our outbound fetch calls to external APIs are intermittenly getting rate limited (429s) or forbidden (403) responses . We only make one request to these endpoints every 15 minutes, so my only guess is that this is due to other scheduled workers sharing infrastructer / egress IPs? Can someone confirm and provide guidance?...

How can I download wrangler.toml from a worker? I know how to do it for pages project

npx wrangler pages download config XXX
npx wrangler pages download config XXX
Equivalent command for workers?...

Worker Tunnel Private IP Access

Hi all! Is it possible for a Worker to access an on-premise server? Eg. MQTT TCP connection I thought this would have been possible using a Cloudflare tunnel - but it seems like the TCP Socket function does not allow private IP addresses?...

Exceeded CPU Time Limits

We have a problem with a worker that handles batch prediction on Azure using setTimeout to wait for the data to be processed (https://www.npmjs.com/package/@dn-institute/cloudflare-workers-batch-prediction). We are getting "Exceeded CPU Time Limits" errors on jobs that take longer than 15 minutes of Wall Time. This is a cron-triggered hourly worker on a paid plan, and the CPU times for the worker do not exceed 50ms. The errored runs show 6ms of CPU Time and 15 minutes of Wall Time. It looks as i...

Workers with Postmark SDK stopped working

I was using the Postmark Node SDK from workers with compatibility_date = "2025-04-11" compatibility_flags = [ "nodejs_compat" ] it was working untill this morning, now getting error in my worker log: ...

Vite plugin (RRv7): How to read in static markdown?

What’s the best way now? Docs are still young and it seems a lot of the previous methods of doing this in workers are deprecated or ignored. Am I meant to sync posts to KV? Thanks ❤️...

Specific Worker Access in Cloudflare Team

Is there a way to allow access to specific workers to team members? I only see a global permission

Requests to none Cloudflare sites with path /cdn-cgi/ fail

A worker which requests content from another site can't access paths starting with /cdn-cgi/ because Cloudflare handles these. Is there any documentation for this problem and why does Cloudflare even handle these requests? Example Worker ```js...