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

[Question] NestJS Support

Now after worker starting experimental support node:http, can we run NestJS on workers? anyone try it?

Invalid WebSocket close code: 1006.

Somehow my websocket closes after 1 minute of inactivity, I don't really understand why, since I am letting the durable object hibernate and this should NOT close the websocket. Any ideas what I am doing wrong? More of my error:
message:...

Tensorflow Lite on workers for inference

Hello, I’m exploring options for running inference on TensorFlow models with Cloudflare’s products. Is it possible to achieve this using Workers or any other Cloudflare service? Any technical guidance or references would be greatly appreciated. Thank you!...

Image Transformations on workers.dev urls?

Do image transformations not work on workers.dev urls? I have a zone with Image Transformations enabled, and in the Transformations settings I have included a workers.dev url under "Specified origins". I have my domain listed, and my preview url listed, which is a workers.dev url like this: ``` xyz-web-preview.myaccount.workers.dev...

Limits to Secrets?

I am designing a system using workers that will have multiple tenants. I want to store secrets per tenant. Are there any limits (e.g. size or # of secrets) to the secret store? Also related: how does scaling work for the workers? I don't think I can have a dedicated worker for a tenant, right?...

Workaround to import third-party libs on Workers Scripts?

I'm trying to build a full-stack app using Hono + ReactJS with Cloudflare Workers for Platforms. My pipeline now involves generating the components, sending these components to Cloudflare Containers, in Containers, I'm compiling React with Vite, and creating the Worker Script. I made a simple API that returns some hard-coded products with IDs and prices. Then I return these scripts, and upload them to Workers for Platforms using formData.append It is all working and is actually fetching data But I would like to extend this back-end to use Hono or create more complex API logic using any other third-party library. How can I do it? Am I thinking about it in the wrong way? How could I use Workers for Platforms to create a more complex back-end logic? ...

Worker spawning a Browserless container - Wrangler causes WS dropouts

I'm trying to set up a worker that can spawn containers that runs Browserless/Chromium image. If I run that image directly through a docker-compose, I am able to connect php-chrome and puppeteer to the containers websocket, but if I use wrangler I seem to have sockets drop out, they'll connect fine and navigate to a page, but at times it'll fail to navigate and/or input on the page. Seems to only happen if I'm running wrangler locally developing and have had to revert to using docker-compose for...

What's the recommended way to use environment variables in a SvelteKit project?

Hello, I'm new to workers and want to know how I can manage and access environment variables in a SvelteKit project with Vite, the docs are really vague and confusing on how and the SvelteKit docs mention using getPlatformProxy but I'm not sure if it's for local development only or also prod, How am I supposed to use them?...

Streaming response breaks on one Cloudflare account, but not the other

I've discovered that streaming is broken for a cloudflare worker, but only in one of my accounts. Working deployment: https://tss-streaming.jakst.workers.dev/ (streaming works on every request) Broken deployment: https://tss-streaming.jn-endform.workers.dev/ (streaming only works on every ~10-20th request or so) ...
No description

How to deploy a full stack app using cloudflare workers with astro as frontend and hono as backend?

I used npm create cloudflare@latest -- my-astro-app --framework=astro to create my starter template, then I create an api/workers.js with ``` import { Hono } from 'hono' const app = new Hono()...

Prevent binding override

How do I make workers not override the D1 bindings defined from the dashboard when I push?

Worker -> Durable Object fetch RPC call performance in Rust

Hello I'm running into some performance issues using Workers and Durable Objects. I'm using rust. I would like some help improving performance. I have a worker that clients connect to. The Worker then passes the request through to a Durable Object (DO) which establishes a websocket connection and sends over a somewhat large batch of data. I measured a measures for a cold start of the durable object....
No description

Cloudflare is redirecting /@foo to /%40foo

I'm using the vite plugin with a SPA. It works in development, but after deploying to production, Cloudflare returns a 307 redirect. Does anybody know what component is doing this rewriting and how to disable it? As far as I can tell, @ is a valid character in a URL.

Migration Pages to Workers

Hi everyone, I need some help with a routing issue after migrating from Cloudflare Pages to Workers. I'm currently migrating my React application from Cloudflare Pages to Cloudflare Workers, and I'm facing a problem with routing. When I access the root URL (e.g., /) everything works perfectly, and I can navigate through the app without any issues — all internal routes are found correctly....
No description

Two Workers + Same Domain + Route Conflicts

I have two Workers that need to share the same domain with path-based routing: - Site Worker: Should handle sub.domain.com/* (everything except API) - API Worker: Should handle sub.domain.com/api/* (API endpoints only) Current wrangler configs:...

Unable to create a Worker with API

I'm trying to create workers using the API. I found the correct endpoint for this but I'm running into a brick wall by getting this error:
Uncaught SyntaxError: Unexpected token ':'\n at worker.js:2:12\n.
Uncaught SyntaxError: Unexpected token ':'\n at worker.js:2:12\n.
Specific error code is 10021 and it points to validation errors but it does not help at all in this case. https://developers.cloudflare.com/workers/observability/errors/#validation-errors-10021...

Github and Workers App

Hello, why doesnt Cloudflare link/add my deployments to Github similar to Vercel does? Or perhaps this feature doesn't exist.
No description

Prevent Bots accessing domain

Hello, how can I prevent bots crawling my page? They are trying to reach sites, which I don't use anyway but it's annoyning and also the traffic goes up. Appreciate any help....
No description

Smart placements and "whats used"

If I have "smart placements" turned on for a worker and I run it for say 1 week, it shows me the "potential savings" in a table on the 90th%'s and it seems to be that there is a roughly a 50/50 split on some are faster, some are slower, but the question is, which actually get used here as it doesnt seem to say, do the 50% that are fast on the "close to user" get used with that, the 50% that are faster on "smart placement", use "smart placement". Its sort of clear as mud to me? Obvioulsy I wan...

Possible to Access Worker Invocation/Request ID inside Worker?

I have a worker that sits in front of some API endpoints to handle some business logic. The worker eventually forwards a JSON payload to the API endpoint via a queue. TL;DR; I want to append the invocation/request ID I see in the worker logs so I can better debug between CF and my API backend. Is this Request ID/Invocation ID accessible inside a worker? Thx in advance for the help....
No description