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

Dramatic slowdown when streaming large body

I am trying to debug what might be causing my production deployment to respond so slowly. Here is the link: https://h2-prod-a12f47db3018f82aae88.o2.myshopify.dev/business/fleet-aware. As you can see the server response time of the initial html is approximately 1s. However I have logged the execution time of all my code from beginning to end including react rendering time and I am logging <100ms processing times. I can see this seems to be an issue specifically with the worker runtime because I can see that if I run my code locally the execution time I log is indeed longer (400ms) but the initial html request server time I see in the browser is roughly identical (~400ms) indicating no overhead when running locally. I believe this 900ms slowdown when running in production is proportional to the body of the HTML because I observe approximately 100ms slowdown for a much smaller body page: https://h2-prod-a12f47db3018f82aae88.o2.myshopify.dev/business/cs-test. (The initial request is usually over 1s, but subsequent requests range from 200ms to 800ms). Here are the basic facts laid out:...

from wrangler deploy to on-push

I have a worker application which I currently update via command line. how can I change it to use github app integration instead?

Update multiple secrets via API

Is there a way to update a worker once instead of multiple times when updating multiple secrets? Like a bulk secrets endpoint or something? Or should I move those secrets into an object like ``` { ...

Better error logging

Hi, I am trying to log the errors in a better way to include the stack trace on the logs. When I checked the docs, (https://developers.cloudflare.com/workers/observability/source-maps/), once source maps are enabled, we would see the trace with respect to the source maps. But after enabling, I am still seeing the trace with respect to the minified version (js). ...
No description

A unique URL and for each Workers build like Cloudflare Pages

I have a wrangler.toml file that has my name set to "website". I want to also have another worker, "website-staging" which is available on a different URL and I want that worker to build all branches. But my wrangler.toml is committed to github so it will always use that worker and overwrite my production worker. Any ideas on how I can set this up right? I feel like Cloudflare Pages had this figured out and would do a deployment to a unique URL for every build

Vitest monorepo service bindings and "The RPC receiver does not implement the method"

I have a monorepo that looks something like this: ``` /packages/api/{my hono server with Services bindings} /packages/services/...

Wrangler: blocked by CORS policy: The 'Access-Control-Allow-Origin' header

When testing locally via Wrangler, I get a CORS error for making a fetch to YouTube. in the client-side HTML page (in ./public/index.html NOT via Workers, but pure frontend). But when I use the the same HTML directly in the browser, it works as intended, with the results of the API call. I already added Access-Control-Allow-Origin: * in the ./public/_headers file....

Do Workers now have a preview environment?

Since pages is moving to workers, does that mean we can manage multiple workers environments (with variables/secrets) for both dev and prod projects like how pages exists now? I dont see this toggle in existing workers dashboard. But i do see preview urls (but im assuming thats just urls)....
No description

bundling static assets

I have some npm packages I use in both the worker, and in the html/js page I serve in the static assets. Is there any way to automatically bundle the html page so I can easily use the package there too?

Build error: too many open files

I am building a Next.js project on Cloudflare Workers, but I always get this error, could anyone help me? ``` 22:31:34.611 ... finished build of 7 collections and 106 documents in 1144ms 22:31:34.625 âš  No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache 22:31:34.630 Attention: Next.js now collects completely anonymous telemetry regarding usage....

Create worker from existing local repo

I'm looking for information on how to create a worker with c3 cli from my local nuxt repo that has git initialized ?

Dev vs Production deployment

According to the documentation, when creating a project with the Vue framework, it also creates an additional worker under server/index.js. I have written a worker that interacts with the D1 service in this file. When in development (npm run dev) the worker interacts with d1 without any problems. When deploying it to production (npm run deploy), the query function works as expected, but update function does not appear to be working. I have tried watching the logs and it appears to be exectuing the function as expected, but the database never reflects any of the updates Here is the fetch function that retrieves the data that works as expected: if (pathname === "/api/products") {...

Can't save, only deploy

In my workers, the option to save is usually grayed out, with the explanation (on hover) that I need to switch to modules format to enable saving, rather than only deploying -- but all of my workers are indeed using modules syntax. Is this a Cloudflare bug? Am I missing something obvious here? It would be nice to be able to save 😅...
No description

workers vs pages deployment

it's been a while since i last deployed something to CF pages but at that time CF was on the transition (i think) to merging workers and pages (and that pages will be deprecated at some point?) my question is where should i deploy my react app, it's a purely static react app and the backend is hosted on a VPS (similar to this https://github.com/benawad/how-to-roll-your-own-auth where although the frontend is in nextjs, it doesn't use next's buitin api routes) ...

Where is static-file hosting documented?

I have static files I want to host and the create-cloudflare script has an example for that, but in its wrangler.jsonc it doesn't include a main key which, according to the note in https://developers.cloudflare.com/workers/wrangler/configuration/#inheritable-keys is required. I'm assuming it's not required in this case because it's not a worker. But then, what is this exactly?...

SvelteKit front-end on CF Pages or CF Workers Assets?

Hi. I'm about to start a new project for my client, a new headless CMS + front-end. My usual stack contained SvelteKit on Cloudflare Pages, but reading about Workers Assets got me thinking about continuing with Pages or moving to Workers Assets. Many online comments (all unofficial) suggest that Workers Assets will push out Pages sooner or later. I would appreciate any guidelines on a subject. As the song goes - "Should I stay or should I go"? Cheers....

Questions About New Services Coming in June

Hey, we saw that the container service is set to launch in June and were wondering if there are any plans to roll out Cloud Build or Artifact Registry services around the same time. Could you let us know if these are coming soon or if there’s any info on when we can expect them?

Using Agent SDK to Support Long-Running SSE Connections

I'd like to experiment with Server Sent Events (SSE) and Datastar to serve up an interactive website using potentially long-running SSE connection streams. I've read about ways to game this in standard workers but there is a CPU-limit that can occur which requires a keep-alive signal on the stream to bypass and it's not "officially" supported (meaning, this might not be allowed moving forward). I notice that the Agent SDK specifically calls out support for long-running SSE connections as being supported: https://developers.cloudflare.com/agents/api-reference/http-sse/#implementing-server-sent-events...