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

Cache external requests

Hey folks! I have a SvelteKit app deployed through Pages (so my server endpoints are counted as Workers from a CF perspective). In my page server load function (+page.server.ts) I have this:...
No description

Worker Analytics Engine query on local

Hey, so i am testing this feature locally but how i can query the data since on the https://api.cloudflare.com/client/v4/accounts/:account-id/analytics_engine/sql shows no tables

queue consumer exceeded cpu limit after 32s

Hello, my queue consumer event is repeatedly failing after exactly 32,000ms (CPU time) with Exceeded CPU error. Wall time is approx. 120s. In the docs (worker limits) there is 15min limit for both CPU time and wall time. Any idea what could be the problem?...

Thrown exceptions doesn't count as failed requests

I have a Hono based API, running on Workers. Even though requests are failing, they do not show up as failed in the Dashboard, nor logging endpoints like Baselime. I have tried explicitly throwing an exception: ``` import { Hono } from "hono";...

Question regarding worker caching

I have a worker that acts as a rest api to CRUD blog posts, the worker uses KV as the database. When reading a blog post (the main thing I'm focused on improving), the worker simply returns raw html thats stored in KV. The worker is fairly lightweight, when doing a read, it does nothing more than a KV read and returning the result. I have 2 issues that im trying to resolve: (1) If I wait a minute or 2, the first request to the worker always takes over 500ms~ (instead of 40~ms). I dont know for sure what the cause of this is. If I refresh a few times, it speeds up. But then seems to just reset after a bit. ...
No description

workers.api.errors.tail_worker_not_found

When I attempt to PUT /accounts/$ACCOUNT_ID/workers/scripts/$SCRIPT_NAME , I observe the following error:
{"result":null,"success":false,"errors":[{"code":10203,"message":"workers.api.error.tail_worker_not_found"}],"messages":[]} at workers.api.error.tail_worker_not_found (cloudflare:10203) at ...
{"result":null,"success":false,"errors":[{"code":10203,"message":"workers.api.error.tail_worker_not_found"}],"messages":[]} at workers.api.error.tail_worker_not_found (cloudflare:10203) at ...
...

Suggested xml parsing and building packages

Hi! We have a few XML APIs that we have to maintain in Workers, and I am interested in hearing experiences from other users of Workers! What do you use for parsing? What do you use for building?...

Abort signal is not triggered

When I use this code, it doesn't trigger when user disconnects from the worker. But it shows an error X [ERROR] Uncaught (in promise) Error: Network connection lost. in the console somehow. ```js...

problem with d1 locally

I am developing several workers that will use the same D1 but locally each one creates a different database instead of sharing the same one already created. I put the same database_id in both but it creates different dbs locally
No description

How to develop and test Email Workers locally

I want to use this feature to forward email messages to my server, but I have no way to test it locally before deploying it to cloudflare, does anyone know how to test the email feature locally?

knex+workers TypeError

I was working with Cloudflare Workers + bun & Hono and was using Knex as my orm. I was successfully ably to make a connection on Cloudlfare Pages to Knex+Postgres with Connection Pooling however on Workers I am recieving a TypeErorr. I tried using both the connectionString and specifiying the individual parameters for the database. Additionally I set node_compat = true and also added the
node:
node:
prefix previously when using compatibility_flags = ["nodejs_compat"] ...

Are Page Functions bundled differently than regular Workers?

Does anyone know if Page Functions are bundled differently than regular Workers that you deploy via wrangler deploy? I have a Worker that lives in the same project directory as a Cloudflare Pages site. My Worker fetches data from an external API: https://github.com/AleksandrHovhannisyan/aleksandrhovhannisyan.com/blob/977e2c600ec5c629db61f8ee2eaee60e1ef86923/functions/api/comments.ts...

Why is URL empty for request from kv-asset-handler and do header changes work with wrangler locally?

I am trying to apply headers based on the url, but testing locally, the response url is always empty. I'm also wondering if its worth changing the response headers at all, because would that really change the way the assets are cached on the server or would it just affect the HTML?
No description

data cannot be deleted from existing worker

Selecting the option to permanently delete files/folders doesn't work under certain conditions, as they remain in the filesystem and show up the next time the page to edit code is visited.

Is flareact available for Arch-based distros?

I would like to use Flareact for my Cloudflare worker. However, every time I run npm install flareact, I encounter an issue which I really don't know how to solve. See the Github issue I just posted for more informations: https://github.com/flareact/flareact/issues/261 . This leads me to ask: is flareact really available on Manjaro or Arch? I also saw that flareact cannot work on Windows, so the number of supported OS may be limited....

Cannot access kv namespace

Im trying to make a cache system using kv namespace in wrangler and im trying to acesss it like so env.name.get('key') but it gives reference error env not defined. also i have added the namespace name, id and preview_id to wrangler.toml file help pls...

Are worker alerts free?

Hi, is durable objects alarsm available in free plan? it seems to be an alternative to cron but is more programmable so we don't waste free resources. I tried searching but couldn't find a answer.

How can we detect web request vs non-web (backend/curl/etc)?

I'm currently using the origin header as part of our access control strategy but realized this header can be set via non-web clients. Is there a strategy to detect requests coming from the web vs curl-type or backend environments?