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

Build timeout at npm install?

Hey folks, I have a worker build that keeps timing out at the npm install step, does it really make sense that this take 20 mins? Is there anything I can do to debug?
No description

Websocket worker

I am trying to write a worker which handles websockets. I understand that Durable Objects are usually the more suitable solution for this, but I believe that this is the exceptional case. My use-case only involves single clients, without any multi-client coordination. My existing non-CF-worker codebase uses axum for the HTTP routing service. But, the axum ws flag pulls in a bunch of dependencies which do not build in WASM. Is there any strategy for getting websocket support in axum working on CF workers?...

I can't use fetch in workers

Hi, I'm having a problem with fetching external links, I'm using Worker and on site the fetch works for external links but when I deploy to Cloudflare, the fetch stops working That's my code ```ts interface Env {...

The response of a fetch() request in worker is different from same request in any other environment

I have a domain xolotto.com and subdomain blog.xolotto.com managed by Cloudflare. When I make a request from any browser https://blog.xolotto.com I have the response STATUS 200 OK and the content of the test page, which is expected. However when I make a fetch request to the same resource from the worker, the result of the fetch is STATUS 403 UNAUTHORIZED: export default {...

Websocket subprotocol results in Error: The script will never generate a response.

Websockets - sending subprotocols (auth token smuggling) results in Error: The script will never generate a response. Client:
const ws = new WebSocket(wsUrl, "potato");
const ws = new WebSocket(wsUrl, "potato");
...

Help debugging high CPU time in worker

Hey guys I really need some help to understand why I am seeing such a huge CPU time for a cloudflare worker. I am talking in the hundreds of ms which seems completely unexpected to me. I have attached a profiler from the worker that maybe someone with more experience in reading it can give me some hints because I've been studying it closely for some time and I feel like I am only extremely slowly inching closer to understanding. This worker is a queue consumer and producer. It produces recursively until enough tasks have been run. Basically all it does is async calls to an external api and db calls. One run of the queue handler would be around 10 fetches and ~40 db calls but in a transaction. I'm using kysely to access my db in a transaction and twisted to access the external api....

How can I add cron job to `wrangler.json` file?

I used svelitekit framework template and hosted to workers. I see this in my wrangler.json file: ```json "main": ".svelte-kit/cloudflare/_worker.js"...

Issue with esbuild + workers runtime, static method

The issue is that esbuild compiles some typescript into javascript, and then cloudflare is not able to handle the static built file. The error is ``` ✘ [ERROR] service core:user:silverkey: Uncaught TypeError: Object.defineProperty called on non-object...

How can I get a rate limiter working for my cloudfare workers proxy?

I recently made a roblox API proxy using cloudfare workers. I use the paid plan and my current concern is that if somebody were to get access to the link im sending requests from they could spam it which would result in my account being charged. How can I make sure theres a daily / monthly limit that it doesn't go over with requests? Thanks in advance!...

White label my app/service workers.

Hello there !! I am trying figure out if there a easy way to deploy clouldflare worker to mutiple prod env.. here are my use cases Web app that is deployed as A.com and B.com, each having it's own env vars.. pretty much as two separate apps....

Missing "cloudfare:email" npm package.

I'm trying to create an email worker using cloudfare docs but I'm unable to figure out what package I need to install. I've created a simple function for my pages app that would send an email but during deploymet I get the following error. Could not resolve "cloudfare:email ...

POST method is not working in fetch inside Queue Handler

Hono version: 4.6.20 Wrangler version: 3.107.2 I've tried a lot but fetch function inside queue is not executing in the worker both deployed version and local dev server. ...

Log push sends a single log line from an RPC service twice

Any console.log from this RPC stub gets sent twice to my log sink ``` class Payments extends RpcTarget { logger: Logger;...

Using local DO bindings from another worker script

I am trying to use DO bindings for local development but I am running into some issues. The docs (https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development) seem to indicate that you can bind two local workers by calling wrangler dev on each of them. But that is giving me an issue. My DO worker is defined like this: ``` export class DurableObjectClassName extends DurableObject<Env> {...

Getting DataCloneError while using instance of a class as return value of RPC method

Error message: DataCloneError: Could not serialize object of type "st". This type does not support serialization. Hono route ``` app.get("/pay/:id", async (c) => {...

Browser rendering support localstorage API?

I am testing a page with multiple languages ​​and that requires a session, this data is saved in local storage, but it seems that it is not working. const page = await browser.newPage(); await page.goto(body.url,{ waitUntil:body.waitUntil??"domcontentloaded", timeout:0...

SvelteKit (Vite) + D1 + Prisma Local development

I have a SvelteKit app that I'm developing with a D1 database accessed through Prisma. I'm trying to run the Vite development server locally and have it connect to D1 locally. My app works when deployed to workers (with experimental assets enabled), and can read/write from the D1 database via Prisma....

Connect Github

Hello where i can connect the github repo for push and exc
No description

Worker and R2 Storage

Hello everyone, I would like to ask if it is possible to let the worker count my r2 traffic and tell me how much bandwidth I use every month.

Issues with runtime variables and secrets

Hello guys I have a cloudflare worker app that's connected to a git repo and auto deploys the new changes whenever I push. But each time it does that I always need to add my database credentials from the dashboard...