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

System Prompt for Cloudflare Workers

I build a system prompt (to be used inside cursorrules or any other ai tool) to generate cloudflare worker code: https://github.com/advany/cloudflare-system-prompt I would love to get PR's to improve this so it makes it easier to generate cloudflare worker code!...

How to access environment variables in Cloudflare Workers when using RPC binding

I'm working with two separate Cloudflare Workers, where Worker A calls a function in Worker B via a binding (RPC). Worker B requires an environment variable to send an email, and this variable should be scoped to Worker B itself, so it doesn't depend on Worker A's environment. Here's the relevant code for Worker B: ```typescript export class WorkerEmail extends WorkerEntrypoint {...

Does it worker get its own wrangler file

Hello. Does each worker gets its own wrangler file or its one wrangler file per project? I'm asking for a few reasons but one, is that when I created a worker using the UI, I was not provided with a wrangler file but when I tried to create one, it told me this project already has a wrangler file. Try it out yourself. Create a basic worker, go to edit code and try to create a wrangler.toml file. It'll give you an error saying that it already exists....

Worker path not marching redirect URL hosted on a bucket

Hello. I'm using the basic worker example on cloudflare called "Common Worker Examples". My domain is hosted on a gcloud bucket....

node modules error when importing postgres in my worker.js file

I'm trying to add hyperdrive to my worker, when I import the postgres package into my worker.js file I get this error: ``` [WARNING] The package "node:events" wasn't found on the file system but is built into node. ...

how can i delete my index.js on cf webiste

how can i delete my index.js on cf webiste

Urgent help with reverse proxy

Hi Guys, I was trying to reverse proxy to do SSR for a webflow site. everything worked except some times the proxied page scripts are not loaded. I have to refresh multiple times to make it work....

Slow Response Time

Hi, I'm using workers + d1 and my domain is managed by the Cloudflare and my service is responding ~300ms to return a static object with the version of the API. Can someone help me to improve this? In Brazil, for example, the DNS response is very slow......
No description

npm install timeouts with Workers builds?

I'm noticing build timeouts with my Turborepo npm monorepo which contains about 6 cloudflare workers (and a page) as well as a handful of packages (see screenshots) i'm assuming the issue is because of the large amount of npm dependencies we have across all projects, but i'm not sure what to do about it using install-strategy=nested in my .npmrc, not sure thats relevant...
No description

Workers concurrency

Maybe a dumb question but I tried to learn about concurrent requests to workers - when documentation says only one instance of the worker in a edge server, how will it handle let's say we get 100 requests concurrently to the same edge server? How are memory limits handled? Will it span more workers in the same edge location or it will reject the requests if the instance is already beyond 128mb. Are cancelled requests retried? I am a bit lost trying to understand this topic even after a lot of research into Cloudflare forums also. How do we plan for concurency? GCP Cloud Run offers it as a configurable parameter for each instance of the container....

Using WAF to block Traffic

Hello, We use workers to host our site. Over the past few weeks we noticed some major attacks on our API. We thought it was on the API direct, but turns out after watching the Stream Logs, that we have some people able to bypass Cloudflare protections on the website using crawling tools. We use a subdomain company.workers.dev. However, I this links to our CNAME for our company.com website. I am inside our company.com website WAF settings and attempting to block a few subset of IPs from our workers.dev account page.
How or why is the block not occuring? What light switch am I missing?...

Unknown error 10013

```Error on remote worker: APIError: A request to the Cloudflare API (/accounts/3ee55606f881222ad1efb703537713b1/workers/scripts/backoffice/edge-preview) failed. at throwFetchError (/node_modules/wrangler/wrangler-dist/cli.js:122866:18) at fetchResult...

D1 storage operation exceeded timeout which caused object to be reset

Many people say that this error occurs rarely when operating d1. I am one of them. Is there anything we can do about it, or do we just have to wait for the administrators to fix it? If there are any alternative plans, please let us know....

rate limiting issues

Hi Im using the cloudflare rate limiting beta, and it works fine when I make my requests through the browser. When I make requests through my local API client (bruno) it seems to have no effect and will never rate limit the user even if they exceed the threshold. Don't really understand why....

upload_source_maps=true is not working

I made a Hono API, and when I log the error in my logging middleware it doesn't show the original file location. It look like: ```typescript Error: test...

Cloudflare #Workers possible #CRON #bug ? worker being called tens of times

Hi, Context worker script: - a) not using CLI; but web interface to copy/paste updated script, debug using console...
No description

socket.writable.getWriter().write() hangs at 7th write

hello, i have a Cloudflare Workers to act like a "server ping service" using cloudflare:sockets. Below is my code for pinging an IP address using sockets, with amount time, and server is the WebSockets Server connected to client for sending back the ping data: ```js const pingServer = async () => { for (let i = 0; i < amount; i++) { try {...
No description

Can i handle cache in dashboard?

Is it possible to view the list of cached keys in the Cloudflare Workers cache api and purge specific keys from the dashboard via GUI?

Queue consumer from nextjs worker

I'm trying to figure out what the project structure would look like if you're using the nextjs framework and you're deploying to workers. Supposedly, worker nextjs should support effectively all services (creating durable objects, workflows, service bindings). But where would all of those worker specific files be located? They wouldn't be in the app/api/[route] for nextjs backend routes. Do people just make a seperate folder at the root for all "worker functions"? Any examples people can point to?...