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

Using cloudflare vite-plugin, what secrets/bindings do preview urls use for non-production builds?

Is preview its own environment that can be configured in wrangler.toml? ``` [env.preview] [env.preview.vars]...

Bug in Cloudflare dashboard

- Live logs view - Open an entry - See a flash of your logs, and then "no events in selected timeframe" Looks like one of your backend APIs is reporting bad data:...
No description

Is it possible to run Bun.js?

Is it possible to run Bun.js on Cloudflare Workers? Has anyone successfully implemented this?

Error when deploying Worker that has binding to EU R2 bucket.

When creating R2 bucket in the EU, and deploying a worker binding to it, I get the error message: ``` ✘ [ERROR] A request to the Cloudflare API (/accounts/{account_id}/workers/scripts/{worker-id}/versions) failed. ...

Create alert for high error rate on worker

Is it possible to create an email alert when my worker is throwing too many errors based on the logs? Like Google Cloud does.

Worker with --remote not working (Error 1104)

Hi. Yesterday I was setting up a worker to be able to run it locally with remote resources so I can debug the code among other things. It was working fine, however, this morning didn't work. No changes in the code.
yarn wrangler -e dev dev --remote
yarn wrangler -e dev dev --remote
I can provide a Ray ID: 9354db749b4704ad...

The deploy with workers button no longer creates a fork of the original repo.

I usually provide deploy to workers button as an easy way to self deploy my project to friends. And then let them sync their forks to mine for new features. Currently it seems like deploy woth workers creates a new repo and thats not very ideal for my use case

Best-practices and errors for CFworkers+Hono API in monorepo

Hey guys, new to CF. I am currently building a Turborepo and have started researching cloudflare for my dedicated API. I am having some problems with doing a simple Hono app and am reaching out for help as the docs are difficult to reason with. Attached are some context images. I am getting TS errors from my TSConfig with the recent worker-configurations.d.ts typegen file. Not sure how to fix it. Outside of that issue, I am wondering, what are the best practices around CSP and CORS and environment variables? Currently using a Hono middleware with .dev.vars for environment variables, but I am not sure how to access those variables in the hono middleware for setting (for example) the allowed origin headers....
No description

Secret Store In Local Dev Mode?

I am using the new Secrets Store, and using them in a worker using the binding in the toml file, but in dev mode using npx wrangler dev the console shows : Secret "MDB_URI" not found Well Okay the docs say : ``Local development mode...

Worker dependencies failed as soon as Bun detected?

I used the React Router template and deployed it successfully on the web UI, but when I installed the packages locally, made some changes that shouldn't affect anything and upgraded packages, the deployment now fails "while installing dependencies" and detects Bun 1.1.33 "from the environment", even though I initially never specified any Bun-related information in any files but I did have a lock file that I tried removing, and even though I have specified packageManager as [email protected] and installed devDependencies of the same version of bun and Node 23.11.0 with BUN_VERSION as the same version both in my wrangler script and in the web UI. What's going on and what am I doing wrong? ```log...

wrangler dev error

why can i not fidn a way to dev functions/api/status.js? it works ok on the web on /api/status but i cant find a command to make it work
No description

Suddenly all our ctx.waitUntil workers are failing?

We have been using ctx.waitUntil for 2 years already with Cloudflare workers with the basic code sample below. This has always worked without any issues. Suddenly about an hour ago, all our workers with ctx.waitUntil fail with the following error message: "Can't read from request stream after response has been sent." This has never happend before and we haven't changed our code at all . Wondering if something is down with Workers? ctx.waitUntil(executeWebhookWait(request, env, pathName)); finalResponse = { success: true}; return new Response(JSON.stringify(finalResponse), { status: 200, headers: {...

How to define RPC methods on a separate file

I have an RPC method that is very long and thus don't want to define in the same place as other functions. I though about doing myFunction = myFunction but it complains that The RPC receiver does not implement the method "myFunction". Since myFunction uses this it's defined as: ```ts export async function myFunction( this: AuthWorker,...

Service binding config with the React template + local dev

I've been successfully using service bindings between back-end workers using the basic template and following the guidelines posted here: https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/rpc/ However, when using the React workers template, I can't seem to connect to service workers the same way when testing them locally. Do I need to configure them differently in wrangler.jsonc? (FYI each worker is in its own project/repo) The service binding entry in wrangler.jsonc is as follows:...

Create a New Worker Menu is Missing.

I recall using the "Create new Worker Menu" on the Workers & Pages > Overview page. Can anyone help me understand why I can't find this option anymore? Also, is there a way to create a new worker without using the template? Thank you!...
No description

R2 worker fails to put (some) files with error 10001

Since a couple of weeks back, our production R2 worker that we have been using without trouble for more than a year suddenly refuse to upload some files. In particular, TIFF files from some cameras seem to be consistently refused. The error message is "put: We encountered an internal error. Please try again. (10001)" Trying again most definitely does not help. It seems the exact files are the problem, since a lot of other files can still be uploaded....

defining custom domain in routes parameter in wrangler.jsonc impacts local host

Context: - I have added a custom domain as the top level param to wrangler.jsonc `"routes": [ { "pattern": "mydomain.com",...

RPC `Service<mysvc>` type doesn't have RPC method properties

I'm trying to declare my RPC service like so, but never get type safety on the RPC methods. ACCOUNTS_SERVICE: Service<import("@mymonorepo/services").AccountsService>; It errors with Property 'myMethod' does not exist on type '{ fetch(input: RequestInfo | URL, init?: RequestInit<CfProperties<unknown>> | undefined): Promise<Response>; connect(address: string | SocketAddress, options?: SocketOptions | undefined): Socket; }'.ts(2339) ...

R2.get() throws Unspecified error(0)

Hi, I have a Worker that gets a JSON file from R2. Sometimes, I get an error that says "Unspecified error (0)." There’s no other info in the logs. Has anyone else seen this when using R2 with Workers?

Worker Websocket TTL Cleanup

Hello! I'm looking to completely cleanup/delete a durable object once all connections are closed. I tried using an alarm following the exact same alarm code as the TTL example in the docs (https://developers.cloudflare.com/durable-objects/examples/durable-object-ttl/) minus the fetch part. Just defining a 10 minute alarm in the constructor and then an await this.ctx.deleteAll() in the alarm function. Somehow this just results in the alarm being continually triggered once every 10 minutes for all eternity. The alarm never stops, which tells me that the DO is never cleaned up. My current problem I'm trying to solve is to have a client start a long running async REST API call. This api call returns a transaction id which the webpage then listens to for updates using that specific transaction id (which is a durable object websocket server). The worker eventually has a callback invoked from an external server which lets it know the transaction is complete. This callback event is passed onto the durable object which publishes a message to websocket clients. Once the client receives this message (or the TTL is reached in the case that the callback is never invoked), the server should shutdown and the DO clean up....
Next