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

CF Rest API call works with wrangler, Unable to authenticate in worker?

Same function on the Cloudflare TypeScript SDK, same parameters, but deployed worker call fails with: {"code":10001,"message":"Unable to authenticate request"}]

Worker Logs is now included in your plan. Review and accept changes to your plan.

When I try to accept it in the modal I get this: workers_observability.api.error.internal_server...

Avoid hardcoded IDs in the repository

Hi everyone, I'm testing the worker and I have a question: Is there a way to avoid hardcoding the ID of a D1 in the wrangler.jsonc file to prevent it from being available in a repository, like GitHub?...

Private NPM registry install does not work on Worker Builds

I'm not quite sure what the issue is but there appears to be one. I setup my workers build exactly the same as my pages build with an NPM_TOKEN set in the build env. However sometimes the build fails with ...

Deploy to Cloudflare button doesn't work

https://developers.cloudflare.com/workers/tutorials/deploy-button/ When I try clicking on the button shown in this page or any "Deploy to Cloudflare" button, the dashboard shows error dialog....

Are event handlers necessary for RPC?

Are event handlers now necessary? I have workers I don't want to expose to fetch and only want to invoke via RPC. Why cant I do something like: ```typescript import { WorkerEntrypoint } from "cloudflare:workers";...

How do I get access to persisted Durable Objects?

Hi, I'm implemented a worker with durable objects using the following code from TinyBase. This code appears to be fairly standard when creating durable objects from TinyBase. /// Top of Code...

Streaming response disconnect hook

I'm experimenting with a worker that responds with an indefinite ReadableStream - for the sake of this example, let's just say that it sends the current time as a string every second. I'd like to know when the client manually disconnects, and when that happens, write the number of messages I've sent until that point to a data store. Is there any way to achieve this reliably with Workers? I'm primarily interested in Rust, but would also be interested in a TS/JS solution.

Local Integration Testing

I need to test my stripe webhook and also test against my d1 database after the webhook is ran which is not possible via vitest. I cannot use vitest-pool-workers because the endpoint will not be available to my local machine, only the internal testing environment. This is not possible stripe listen --forward-to localhost:PORT/endpoint The first option listed here looks like my best choice:...

How to prevent Worker from running on certain colocations?

We're using Anthropic's API. Some of our users from South Korea are being routed to the Hong Kong Cloudflare colocation, and Anthropic's API doesn't accept requests from China (& Hong Kong). We want to block Workers from routing to Hong Kong (& instead route to, say, the one in Seoul, KR).

upload data to local r2 buckets

hi, i am developing locally with wrangler, and i was wondering if there are any tools to / common paths to interact with locally simulated buckets. i'd like to update them to hold some data, but its not clear how i see on my terminal Your worker has access to the following bindings: - R2 Buckets: - MY_BUCKET: my-bucket-dev [simulated locally]...

Parsing .EML using workers

i have tried using a variety of mail parsers with workers but since workers does not have full nodejs compatibility, i am unable to use buffer or stream etc which is used by popular libs such as mailparser. is there a workaround or a compatible lib which could do it on workers?

Deploying from dashboard disables logs (and resets folder settings)

Hello! I've created and edited a worker entirely in the dashboard. Every time I change a line of code and press Deploy, the logs are disabled. My wrangler.toml, which I also have to re-enable in the folder settings after every deployment: ```name = "myworkername" main = "worker.js" compatibility_date = "2023-08-23" ...

Getting blocked when trying to deploy worker

I came across an interesting issue just now. I tried to deploy my worker with some new code so i clicked on the Deploy button. Then the message "API Request Failed: PUT /api/v4/accounts/ACCOUNT ID/workers/services/forwardreleases/environments/production?include_subdomain_availability=true (403)" came up. So i checked in the Network tab of my Browser to see what's going on and it seems like i am getting blocked by cloudflare? At least i see it when i visualize the html it returns i get this what's shown in the screenshot. Ray ID is:
929a2fba1c461c05
929a2fba1c461c05
I tried:...
No description

Questdb Nodejs Client not working

I get this error when trying to run the questdb client in miniflare. I have posted a minimum reproducible error - https://github.com/apolo-damasco/cf-workers-questdb ```⎔ Starting local server... ✘ [ERROR] Error sending data TypeError [ERR_INVALID_ARG_TYPE]t" argument must be of type number. Received type string ('utf8') ...

Network error with outbound fetch() requests (some domains working, others not)

When using fetch() requests on Cloudflare, we now experience "error code: 525" for the past 4 days on certain worker custom domains, not the workers.dev domain. https://keyauth.win/psdb - error code: 525 https://keyauth-worker.agentreachout.workers.dev/psdb - success (no SSL error) https://prod.keyauth.com/psdb - success (no SSL error)...

Periodically re-importing D1 database and Maintenance mode

I have a read-only REST API serving (semi) static data. Each month the data changes and we basically get a full name database; there is no diff or whatsoever available. So my idea was to drop the existing D1 tables, and run the import script. And in the meantime return a maintenance response....

Error Cannot read properties of undefined (reading 'get')

Hello, I'm new to Cloudflare and Durable Objects. I have written my first test app that attempts to synchronize a TinyBase store into a durable object. I'm receiving two errors for each request: 1) Cannot read properties of undefined (reading 'get')...

My worker serves sitemap.xml but Google can't read it

I don't have a static site on the domain so if cloudflare chooses to not proxy and run the worker then it will fail, but is there a policy about when cloudflare will step back and try to make the client use the static site? I can't be sure that's the problem, so maybe it's something else. Is there a way to see what Google sees?...

Does Cloudflare Workers will handle custom HTTP/S headers?

Hi, I am looking forward to use CW as middleware to create custom headers for a website to secure it in a better way. Website itself has been created using Webflow and there is not a way to add custom HTTP/S headers by the admin panel nor domain registar does not provide any tools to do that. I've learned that CW can do that, so I would like to know how to preprare before I start. Is there an specific knowledge (i know HTML/CSS/JS/TS and tools around like Git quite well). I haven't done that before and I am looking for professional tips to do it properly....