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

can a worker parse an JSON email attachment and connect with an API?

I'm new to this and seeing if this is a viable option for what I'm trying to do. I have a bed and breakfast, and my system sends out a JSON attachment in an email everyday with the day's guests and their contact info. I need to get the phone numbers from that attachment and send it to an API to update door codes. Is this an appropriate use case for workers? If so, Where should I get started?...

Does a worker has access to bulk KV writes?

I want to create a worker that serves as a proxy to KV, specifically for the bulk writes. Can I use the bulk operations within the KV bindings?...

Worker fails to request from reachable endpoint (Bad Gateway | 502)

I have a worker that runs on a schedule, It runs and makes a GET to an endpoint on my backend hosted on another platform but the domain is on Cloudflare. I can not get the worker to reach the gateway as it always recieves a 502...

Workers build unstable?

Workers build is slow compared to last Friday. hung on bun install 1.1.28, waited 12 minutes and it didn't finish. retry and it finished immediately.

How can I access the encrypted build variables inside the shell?

When encrypting a build variable in the Cloudflare Worker build function, the build command will return an empty string when attempting to reference the build variable.

fetch() sometimes returning 520 even though request to origin was successful

Using a database API via a non-standard port (I cannot test it with a standard port) sometimes returns a 520 status code even though the request actually succeeded. As far as I can tell, the origin database is actually sending back a 200 response, that cloudflare is somehow turning into a 520 before it reaches the worker. I've ran through basically every analytic I can measure and I haven't been able to figure out why only a very small portion of requests are just failing. Any insight would be much appreciated šŸ™ I've also reviewed that the third-party server is not:...

Accessing Remote R2 while having local assets

Hey, I am trying to build a worker that can access my remote R2 buckets, but still have local static assets to serve. From my research it looks like its common to have an R2 assets bucket to solve this issue, but because multiple develpers are going to work on this worker, we don't want them to share the same assets bucket. Our current limitations: ...

Astro Image component

I'm using the new experimental stuff and using Astro's Image component, but when I deploy the images don't work because it's a url like
/_image?href=%2F_astro%2Flogo-horizontal-black.BLA2JIcF.svg&f=svg
/_image?href=%2F_astro%2Flogo-horizontal-black.BLA2JIcF.svg&f=svg
which is giving error code: 1042...

Using vitest without defining `nodejs_compat` for my worker

I am following the instructions here: https://developers.cloudflare.com/workers/testing/vitest-integration/get-started/write-your-first-test/ It says that:
In your projectā€™s wrangler.toml configuration file, [ā€¦] include nodejs_compat in your compatibility flags.
...

Cannot use assets in remote mode

Hello, I want to use an assets folder within my worker, on wrangler dev everything serves as expected, but when I am adding the --remote flag to the command I am getting this error:
āœ˜ [ERROR] Cannot use assets in remote mode. Workers with assets are only supported in local mode. Please use `wrangler dev`.
āœ˜ [ERROR] Cannot use assets in remote mode. Workers with assets are only supported in local mode. Please use `wrangler dev`.
...

logging solution with forever retention period?

how do you all do logging in cloudflare worker? which library do you all use?

Worker Static Assets __redirects

Hi, I want to use Static Assets to host a completely static react SPA that uses tanstack query. To get URLs working I need to configure __redirects with /* /index.html 200. I see on https://developers.cloudflare.com/workers/static-assets/compatibility-matrix/ that __redirects is supported in workers with this community plugin. But that seems to require a WorkerEntrypoint, which I do not have since my site is completely static. I see there are bulk redirect options, but in testing those drop the path, with no option to keep it....

how to deliver static assets from another R2 bucket directly like open next?

Hi, Iā€™m integrating the H5P standalone library (https://github.com/tunapanda/h5p-standalone) with our Next.js app. We need to deliver H5P content type libraries and content files. The libraries can be in a shared directory, and the content follows the H5P folder structure. Since Cloudflare is now integrating R2 for static assets with the OpenNext project, how can we deliver these assets from another bucket while maintaining the required folder structure?

Clarify Docs On How To Access Environmental Variables/Secrets in ES Modules format with TypeScript

I want to confirm exactly how to accomplish this, and to understand what exactly my code means. I found two different examples, and neither worked for me until I changed my code slightly. It might help to clarify the docs on these pages. I am not clear on why one example has export interface Env at the top, and the other doesn't. Migrate from Service Workers to ES Modules - https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/ ...

Preloading Emscripten-generated JS module in a Worker

I'm having issues preloading a JS/WASM library in a CF Worker - the JS library starts as C++ and then gets transpiled to JS with Emscripten and CMake. I'm transpiling with ES6_SYNTAX and MODULARIZED enabled. I include this JS/WASM library sparks.js into the Cloudflare Worker project which I called hello-wrangler. Below is my index.ts in the hello-wrangler project. I do the imports and then I call loadModule() in a useEffect in hopes to have the module load proactively....

Service Binding for DO does not show up in env

I have a worker (WorkerA) that implements a Durable Object (DOA). This is working fine. I can access env.DOA and call functions on the Durable Object just fine. I have a second worker (WorkerB) that declares DOA as a service binding to WorkerA. When I call env.DOA in this second worker, I get an object with type Fetcher rather than DurableObjectNamespace. Is this expected? Has anyone else run into this? Am I holding this wrong?...

Which library do you use to generate pdf at worker side?

I tried jspdf, pdfmake, but they are giving module related errors.

Workers.dev URL By Organization Issue

Hello World, I have 2 organizations org1 and org2 i want 2 worker urls...

I am trying to add a new binding for R2 after deploying my application on cloudflare in wrangler.tom

, but my pages functions are not picking these newly added bindings and not showing up on settings tab. It doesn't allow me to edit it saying, this project's binding is managed by wrangler.toml, I did add R2 binding on my wrangler.toml. I think, due to this my c.env.MY_BUCKET is coming as undefined at run time.