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

Appending Content-Security-Policy-Report-Only Header to All Responses

I'm looking for some troubleshooting help/guidance regarding attempts to add a Content Security Policy (CSP) header to all responses. To level-set: - Transform Rules are not an option because we use Pages - I'm not able to use _headers because our CSP exceeds the 2,000 character limit imposed by Cloudflare...

✘ [ERROR] Failed to register worker in local service registry TypeError: fetch failed

I'm getting this left and right now on my workers. I've tried the latest 3 versions of wrangler, creating new completely bare bones workers... every time I try and use wrangler dev I get errors....
No description

How to write python workers?

I'm trying to learn how to write python workers because I really don't know much about JS so I better try with python. The examples I found are different and I think some stuff is not being explained. For example, here in the examples page: https://developers.cloudflare.com/workers/languages/python/examples it says that we should import Response and other stuff from the js package, but there is no js package, or well, there is one but I don't think it's related, there is no Response in that package. Then if I go to this example https://github.com/cloudflare/python-worker-hello-world/blob/master/index.py there is an addEventListener which afaik is not part of python. I'm trying to write the worker on python because I need to access environment variables and I don't quite understand how to do that in JS, but then again I don't know how to do that in python either....

bypass workers with cookie

Is there any way to bypass workers using a cookie? For example in the case that something catastrophic is wrong with a worker I'd like to set a cookie and just send traffic directly to the origin....

workers.api.error.no_access_to_rollouts [code: 10208] when trying to upload a version

``` pnpm wrangler versions upload --experimental-versions ⛅️ wrangler 3.47.0 ------------------- Your worker has access to the following bindings:...

How access 'env' in the WebSockets Template

Hey, I've got a Cloudflare Worker that implements WebSocket connection. The implementation is from: https://github.com/cloudflare/websocket-template I am wondering how can I access the env variable that is usually available to us when we use the
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
...
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
...
syntax instead of the one used in the template, ```js...

Durable object websocket connections

I want to access the currently connected websockets to a durable object from outside the object itself, is this possible?

Elevated number of 524

Hey guys, we are seeing a lot of 524 responses, while the origin looks completely healthy. Any clues?

Email obfuscated when using HTMLRewriter

Hi, I'm using HTMLRewriter to parse some html data, when deployed I see parsed text has email obfuscated but on my laptop the email shows just fine. I couldn't find this behavior documented anywhere, is it possible to disable this? This is using workers.dev domain. The exact text is [email&#160;protected]

Pages deployments failing (wrangler deploy)

I'm attempting to deploy to an existing Remix (vite with cf) to Pages. Everything has been smooth until today, when suddenly Cloudflare Pages deployments started to fail, and no message is printed. I'm using the direct upload method via wrangler deploy, and it appears to upload the files but on CF pages the deployment fails. I've tested the app using wrangler pages dev and it works fine, any help?...
No description

Deploy by push

Hello is it possible to deploy changes with git push like it's on vercel for my worker? or i have manully do it myself?

Are the api docs for updating worker settings wrong?

Specifically looking at this request: https://developers.cloudflare.com/api/operations/worker-script-environment-patch-settings it appears the request body is formatted how the api typically formats response bodies, and attempting to use this api in this format just returns workers.api.error.content_type anybody know what the correct format for this api request is?...

How to access worker queue producer bindings in local development?

At boot I see this message: ``` wrangler.toml changed... Using vars defined in .dev.vars...

Need some help on collecting coverage in workers.

I know that the coverage via V8 is not possible, but via istanbul it does not collect coverage as well. Getting this error ```js TypeError: this.toSlices is not a function or its return value is not iterable...

how can i fetch a .json file in a worker that is located localy inside of the worker

here is an example image of what i mean https://i.imgur.com/pm8Giv5.png how can i acess the routes.json file insdie my worker i tried using ...

Production workers 100% errors

Randomly started getting 500 errors in production env workers `{ "outcome": "exception", "scriptName": "mage-api",...

`wrangler tail` with WebSockets

Is this not true for any incoming Websocket requests? - I have a console log inside of the websocket.addEventListener("message" in the websocket template on Cloudflares Github pages and I've noticed that it doesn't log those live, only when you close the connection do all the logs show up

Multiple Set-Cookie headers folded into one header

In the documentation (https://developers.cloudflare.com/workers/runtime-apis/headers/), it says that "the Headers.append method will allow you to set multiple Set-Cookie response headers instead of appending the value onto the existing header." However, the following code produces a single concatenated Set-Cookie header when sent to the client: const headers = new Headers();...

Fetching From D1 using Workers

How Do I Create an endpoint using Cloudflare D1 and workers that returns the entire table as JSON when fetched? I want to know what code I need to put in the workers.js file to return the entire table from a D1 database as JSON when fetched. I need this so that on an HTML page, I can fetch the JSON using the public read-only endpoint, and then I already have the rest of the code working, where it creates a array using the JSON....

Workers subrequests

Are workers subrequest "using fetch" limit allowed to be increased (paid plan) beyond the 1000 subrequests limit?