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

Workers GitHub deploy clears runtime variables

Hi guys 👋 I’m running a Hono API on Cloudflare Workers, deployed with the GitHub integration for automatic deployments. Each time I merge a PR, all my runtime variables get wiped, which breaks the API for users. I already have keep_vars = true in my wrangler.toml (this used to work fine before), but recently deployments started clearing the vars again. ...

How to run scheduled builds?

Without deploy hooks support, how to run scheduled rebuilds? I used external cron on pages.

Worker branch preview - DurableObject limit

I'd like to get clarification on the Worker branch preview URLs limitations (https://developers.cloudflare.com/workers/configuration/previews/#limitations). It mentions they won't be generated for Workers with Durable Objects. Does that mean my worker is inherently incompatible with preview branching at the moment? Or will it work with previews, except DurableObject functionality will be broken in the preview?...

How to implement auth with Nextjs on Vercel + D1 as db?

I’m building a Next.js app hosted on Vercel and using Cloudflare D1 as my database, accessible only through a Cloudflare Worker. I need to implement authentication but I’m unsure how to handle it with this setup. What’s the best way to achieve this, and which auth library would you recommend?

need help with these

It keeps failing and loading. i have try everything and still the same. mind giving me a hand?
No description

Env variable confusion

Hi all. Just migrated from pages to workers. Some confusion regarding the env variable settings. 1. I set up the build time variables, they are working properly 2. I set up the other envs on dashboard. Then set my wrangler.jsonc to have "keep_vars": true 3. After deployment, seems that some of the envs are available, but some are not? And they are not just differences between NEXT_PUBLIC or non NEXT_PUBLIC so seems to be bit random. If it matters i have a pretty big list of env variables. Is the best way to add them all to secret manager and reference them solely from wrangler.jsonc? Also, are wrangler.jsonc's env variable available during build so i dont have to add them to dashboard?...

Remote bindings not using preview D1 DB

I've setup the following, however for some reason the DB is pointing to my production D1 DB instead of my second one (I created a second as a preview). Any ideas why? I run bun dev wrangler.jsonc...

How to have worker auto deploy specific environment?

I have a production and staging environment which I'm currently deploying. Prod is the default and deployed automatically on push (via GitHub repo). Staging environment is being manually deployed from local via ...

Error Code 1003 (HTTP status 403) with HTTP Service Bindings API calls including db connection

We're experiencing frequent NeonDbError: Server error (HTTP status 403): error code: 1003 errors. - Error message shows "NeonDbError" but we suspect this is actually Cloudflare's error code 1003, not a Neon-originated error - Neon Support confirmed: Database was operating normally during error timestamps, no 403 errors logged at database layer
- Error code 1003 is documented by Cloudflare as "Direct IP Access Not Allowed" https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/error-1003/...

Is `version_metadata` an inheritable key?

In wrangler.jsonc file Or do I need to explicitly specify it for each environment?...

Clarification on global env and isolate re-use

Based on this change on 2025-01-15, is it fair to say that this guidance in the docs is outdated? Specifically the guidance that calls out risks around polluting global scope:
"When you deploy a change to your Worker, and only change its bindings (i.e. you don't change the Worker's code), Cloudflare may reuse existing isolates that are already running your Worker... As a result, you must be careful when "polluting" global scope with derivatives of your bindings."
In other words, I'm looking to confirm that since Jan 15, you can now use import { env } from "cloudflare:workers"; and know that if the env vars change you'll get those changes?...

Multiple environmental

How can i run multiple environments like dev, staging and prod for nextjs

Cache-Control simple question

Is it possible to have a setup where user from public internet hitting my public API (running as worker) would get a cached response from CF edge (before hitting my API), thus saving me requests count for my free plan? I made my responses return Cache-Control header like this: ``` return c.json(response.results, 200, {...

How will smart placement react ?

If if have a worker who process a lot requests, let's 100M a day and it has multiple zones routes inside, 1 US , 7 EU and 2 APAC. Can we achieve any gain of performance if we setup 3 workers instead of 1 single ? What are the actual scaling happening for workers ? Would it be better to have one per zone ?...

Update Environment vars using the API while still using wrangler for dev & deploy

I have a worker which is created/developed just using the normal wrangler stuff (commands and wrangler.toml). The worker has some environment variables (plain_text) which get updated by an external tool using the Cloudflare API - that works fine. However every time I deploy (with--keep-vars) I still get the prompt "You are about to publish a Workers Service that was last updated via the script API." and I have to say yes - then it works. But this breaks any automation/CI. Is there a flag to always confirm the prompt? Or even better what is the recommend approach for this scenario? Please ping me on response, thank you 🙂...

How to debug Agent's DO?

I keep getting this error and am having a hard time trying to debug where and how to reproduce this error locally. Error: A call to blockConcurrencyWhile() in a Durable Object waited for too long. The call was canceled and the Durable Object was reset....

Banned from site

Banned from a sight for opening too many pages last night. Can't get in contact with the site owner, as their contact info is on their site that I can't visit. Need assistance.

How to debug Worker Error 1101?

I have deployed Next.js app to a Cloudflare Worker using OpenNext. It works well but the Google login callback triggers an Error 1101. It works fine on local and other dev platforms. There log error I see is: Error 1101: Worker threw exception "The Workers runtime canceled this request because it detected that your Worker's code had hung and would never generate a response."...

Attach VSCode Debugger while running more than one worker with wrangler dev

I have more than one worker in my project and wish to debug them locally during development using VSCode. The CloudFlare docs recommend running multiple workers with a single command like this: yarn wrangler dev -c ./app/wrangler.jsonc -c ./api/wrangler.jsonc (docs: https://developers.cloudflare.com/workers/development-testing/multi-workers/#single-dev-command) However, when doing this I cannot deterministically attach the debugger to any specific service. It seems wrangler decides which service loads first (presumably based on the dependency tree between them as specified in the wrangler.jsonc services bindings?) and then only the first worker binds the inspector to port 9229. I've tried rearranging the order of wrangler parameters to influence this to no avail. I also tried adding inspector_port in the wrangler.jsonc but it seems that option is not supported? Is there any way to run multiple workers via wrangler dev and attach a debugger to either all of them, or choose which worker gets the 9229 debugger port, or assign unique debugger ports to each worker being run?...

Next.js requiring env variables in build variables

I'm deploying a new Next.js app to a worker using OpenNext. However I'm running into an issue where it cannot detect env variables unless I also add them to the build variables in the dashboard. Is that normal?...
Next