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

Dynamic dispatch worker call multiple user workers?

Can I call multiple user workers from a dynamic dispatch worker in a single request? And if so, how would that be billed?

Cloudflare warp not working

not priave Hey for some reason cloudflare warp doesnt work when i click connect it just says your internet is

Microsoft Edge marks Cloudflare's Worker edit/preview page as unsafe

When editing a CF Worker online, I've noticed the Microsoft Edge (latest stable version) marks the DevTools part as unsafe. I've tested it with a few Workers on my account and all of them have the same issue. I'm quite unsure what the issue is, I've clicked report as safe and filled the feedback form to Microsoft. That did not change much, sadly. Clicking show unsafe content doesn't really help the issue, as the DevTools console is still unavailable even after that....
No description

Require JSON output from Workers AI?

Hello! Looking through all the models in Workers AI. Any chance to force output response in JSON format?...

TypeScript - Reflect-Metadata decorators being omitted from bundle

Heyo. I'm having an issue with the way Wrangler is bundling my Worker code. For some reason, "design:type" metadata added by the reflect-metadata package isn't being included in the bundled file, however, other decorators do appear. I've tried compiling the Worker code normally with tsc and all metadata was included, so I was just wondering how I can "tell" Wrangler to include those metadata values or if its possible to change the build script entirely. First image is an example of code compiled with tsc, second is Wrangler's code....
No description

what's the point of workers?

Hi, I'm new to cloudflare workers. Trying to figure out what even is the point if you can't seemingly import your libraries?? Like I'm trying to add a custom watermark to my image (cuz cloudflares apo didn't work for some reason) using canvas/jimp, and I can't even do that? I think it's a skill issue but then how do I import node libraries?...

Shared logic between NextJS app or duplicate the logic?

I naively thought I could share the logic from my nextjs app with my cloudflare workers but the environment variables is causing quite a bit of issues. Even when polyfilling with import * as process from 'node:process'; , whenever I use process.env, the nextjs app doesn't understand "node:process". Is it common to simply duplicate the logic for the cloudflare worker? Even my database calls requires a separate env and it's a bit too integrated. Is it common for folks to duplicate their code logic for CF workers or are people commonly able to reuse logic from their app? Is it common to declare something like globalThis.process = process (imported from node:process) when using cloudflare workers for nextjs and cloudflare worker compatability? ...

Worker orchestration idea might be overkill

hi, I need to trigger a processing task inside a worker only 2sec and then once again 10sec after my worker got a POST request. I want all POST requests that came between 0 and 2 secs to be batch processed as a time ordered batch. (2s and 10s are arbitrary amounts and could change)...

Env ,Variables in Github Workflow

I have created a worker and deploy it from github actions. I have certain variables and secrets. Firstly i ahve tried to deploy without setting any variable in the actions but setted up in the dashboard. I have multiple questions regarding this...

Rate Limit not defined on env

Hi I'm trying to add ratelimit binding to my worker but its not appearing on the env variable for some reason? ```toml [[unsafe.bindings]] name = "RATE_LIMITER"...

How to maintain WebSocket client connections in Durable Object?

1) Would it be the correct understanding that in order to use the Durable Objects Hibernation API, I need to extends the DurableObject class? 2) If so, how can I delete a certain clientId on close? In the examples, it doesn't extend the DurableObject class so the handleWebsocketSession method is able to set listeners to delete clientConnectionIds. However, when extending the durableObject class, the webSocketClose and webSocketError methods handle the closing of the client, so I'm not able to refer to the same clientId anymore.. See code below:...

Migration from KV to D1

Hi, I am currently running a migration API in an existing pages project which fetches all resources from a certain KV namespace, and inserts those into a specific D1 database. Since there are quite a lot of items in the KV namespace, an internal server error is produced: Too many API requests by single worker invocation. I understand that internal calls to certain services are limited to 1000. Is there any way to temporarily increase this in order to make the migration process easier? Worst case I can limit the amount of items interacted with, but this is a little more tedious than just being able to migrate it all at the same time....

Per-Deployment Secrets?

I'm encountering an issue with Wrangler's secret management. It seems that Wrangler doesn't support setting secrets on a per-deployment basis. This is causing problems because: 1. All branches that aren't 'main' are automatically treated as preview environments....

Plans to support MongoDB?

Hey there, Are there any plans to support self-hosted Mongo Databases on Workers? Or are there any ways to connect in the meantime? ...

responses with "cf-cache-status: REVALIDATED" are being stored in cache following fetch()

Symptom: Edge worker consistently responds for some requests with cf-cache-status: REVALIDATED and no Age header. This happens until this resposne falls out of cache. It occurs randomly across various requests. Detail: I have an edge worker that is fetch()ing content from another site which is using cloudflare. Sometimes, a response from the origin has the header cf-cache-status: REVALIDATED. What appears to happen is that my edge worker appears to store this header in it's own cached response....

Managing tiered caching from edge worker after origin response received

Hi! I have a worker that is making a request via fetch() to another resource and returning that response. The worker is acting on a domain (incoming request and origin request) using tiered caching. Sometimes I want to NOT cache that response but only AFTER I have fetched it and checked the response content. I do not want to check the response content every time - only when the cache was not present (MISS or EXPIRED). Let's assume that I currently cannot determine what in the request is responsible for causing this but I sometimes get a bad (status 200 but content contains erroneous elements) response from the origin.. I do not control this origin. My cf options object passed to fetch() are cacheEverything: true and 'cacheTtlByStatus': {'200-299'}: 12345, so any 200 response will be cached, even if I later detect that it was bad. I can try to detect the erroneous response but how would I stop this response being stored in cache on this occasion so the next call for this resource doesn't respond with the bad response again? My understanding is that the tiered cache is populated based on the response from fetch(). Is this accurate?...

Mongoose Probelm - pls help ;-;

```js import { Hono } from 'hono'; import mongoose from 'mongoose'; import cors from 'cors'; import userModel from './models/user.js';...
No description

AWS batch jobs

Now I crashed one issue since I am using aws batch jobs for detect objects on video. Anyone can help me ??? ASAP Thank you,...

Access to Cloudflare Images

I am setting up CF Images and it's been pretty rough so far. I got Direct Upload going and now I want to serve the image. It looks like serving the image via a worker and using the fetch subrequest is the most flexible way to go. However, it is beyond me how I can access the image given the image id from the worker? Am I supposed to pass it a complete variant URL instead? Is there a way to load the source image by it's ID and apply transformations to it instead?

Error 1101 on code surrounded by try/catch

I'm deploying a Nuxt.js application and my pages event handler is being called but somehow seems to just "stop" executing code and I get the Error 1101 message. The reason I say stop is that I've added console.log lines between every single statement to pinpoint what is going on and the entire thing is wrapped in a try catch block but the catch is never being called....