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

Unable to add Sentry integration, stuck in infinite loop

For some reason Cloudflare thinks I already have Sentry installed. But when I go to sentry integrations, Cloudflare Workers says not installed. How to I end this madness?...
No description

[Help Needed]: Have large datasets to feed to models

Hello everyone! 👋🏻 I'm currently working on a personal project and have hit a bit of a roadblock. I'm using text generation models to create a chat interface, but I've noticed that I need to specify the system role and user prompts with each query. Unfortunately, there's no option to store a large dataset in the model's memory that it can reference each time it generates an output. What I'd like to do is store a large set of data in one place, which the model can then access whenever I ask it a question. However, I'm relatively new to the Cloudflare ecosystem and could really use some guidance. Is there a way to achieve this using Cloudflare's functionalities or products?...

Difference deploy behavior from wrangler CLI and Cloudflare website.

When I deploy a project across git CLI and already connect Cloudflare Works, and it builds successfully, you can view it at https://be758b82.balanced-chef.pages.dev/, it can open, but the /blog/* page doesn't work, I check everything is OK. After, I tried to deploy the project through npx wrangler pages deploy dist, and it worked well on every page, you can see it at https://fe5e61f6.balanced-chef.pages.dev/ What's wrong?...

Cors blocking using Hono.js and workers

Im using Hono. I add the code above to allow localhost access to my worker, and its worker well. ```typescript app.use("*", async (c, next) => { const corsMiddleware = cors({...
No description

KV Put takes forever to write, or does not write at all

This is my backend that handles kv putting: https://github.com/minhperry/cf-worker-backend/blob/main/src/login/short.ts. As in the image, the request did indeed reach the backend with the corresponding body, which means the put is meant to be successful. However, it has been over 15minutes since I try sending this, everytime the backend does reply with a 201 but the KV put never succeeded...
No description

How to return fallback content from Workers?

I have a single file (an image) that I'd like to return from a Worker, but I don't want the image to depend on the Worker. So, if the worker was to fail to run (from hitting a rate limit or otherwise) the file would still be returned. I've been thinking the best way to do this is to host the file on Pages, and use Functions to execute a Worker as a side-effect every time the Pages site receives a request, but I'm not sure how to do that. Is this possible and if so how would I do it? (or is there a better way?)...

Configuring worker rate limits through API

I'm trying to configure my worker with terraform and was using the new rate limits feature. Is there a way to configure worker rate limits through the dashboard / api / terraform. I've searched everywhere and couldn't find a way to configure except in the wrangler.toml unsafe bindings. Also I have tried creating wrangler.toml only with the rate limit binding in the worker created by terraform but it seems to have no effect. Anyone managed to do this by any chance?...

Email worker triggered multiple times for the same email

I have a simple worker that is triggering on a specific email address. This worker does some attachment processing, add some data in d1, then sending an email back to the user. This is all correctly triggered, and this is the end of the handler: ```ts async email(event, env){ console.log("Worker trigger.. this is logged multiple times per same email");...

Is there a way to combine dev and prod workers projects?

Pages has preview and prod environments. Can we do the same for workers projects?

Trying to add Open Graph tags with Cloudflare Workers in my Vue 3 + Django e-commerce site

Hello everyone! I'm trying to inject open graph tags with a worker for an ecommerce website made with Vue + Django (using an EC2 AWS instance for Database and S3 for images), without using SSR. I tried with different slightly variations of this code, but it doesn't seem to change the og tags (still the default declared values in the index.html file ). Anyone succeded a case like this? addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)) })...

Decompressing large .gz file

Hey there, I'm wanting to decompress a large .csv.gz file (~1.3GB) pulled from a remote origin inside a worker Then I need to load and iterate over the rows in the decompressed CSV (~4.1GB) and add them to a D1 DB....

Magic WAN or Magic Firewall

Hello, I'm not quite sure if this is the right place to post this, as I can't find the appropriate section. I need assistance with acquiring a Cloudflare product, but I would like to clear up some doubts before deciding on the correct one. Basically, I don't want to expose my public IP to avoid DDoS attacks on my live server, so I want to use Cloudflare's services for mitigation and redirection. From what I understand, Magic WAN or Magic Firewall might be my best option, but I would like to confirm this before proceeding...

Auto Setup Tail Worker with Pulumi for Sentry

Is there a way to automatically setup a tail worker with either Baselime or Sentry when deploying a new worker through Pulumi? We do a per user deployment with SST which leverages the Pulumi provider. I would like to be able to setup a tail worker automatically on deployment for my stages to send logs to either Baselime or Sentry. Is this possible via the API and/or Pulumi versus clickops in the console for each worker?

How to access “unsecure site” in Worker?

As the title, I tried to use “fetch” in Worker to access an external HTTP link but result in an error code 525. But I can only use this link to interact with their API. is there any way I can do that?
No description

Workers not getting access to the env object

I created a cloudflare worker, added my openai secret key with npx wrangler secret put OPENAI_API_KEY then input the value. Deployed. Started the local devserver but i keep getting this error you can see in the screenshot. I verified on my cloudflare dashboard that the environment variable existed. Even deleted it, revoked that openai key and added a new one just to ensure it wasnt the value that was wrong and i still cant get it to run. I tried throwing in a console.log and it seems that it cannot access the environment. In the meantime ive created a .dev.vars file and included my OPENAI_API_KEY = myvalue in there and its working now for development but im worried about production. so connectingh to openai with that key , just from .dev.vars instead of the env object....
No description

Running workers conditionally

Is it possible to run the worker conditionally and not for every incoming request? In my case, I'd like the worker to run only for document (html) requests, meaning for every request pathname that does not include a period (since having a period in the pathname means directly requesting a file)....

No loader is configured for ".node" files

My worker uses email-reply-parser https://github.com/crisp-oss/email-reply-parser which internally uses re2 and it's causing a deployment error because re2 imports a .node file