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

Connect to postgres from Workers through tunnel. Is it still possible?

https://blog.cloudflare.com/introducing-socket-workers https://github.com/cloudflare/worker-template-postgres Based on this blog post and the template on github, it looks like they used a custom driver to accomplish that. However, the blog and repository were last updated three years ago, and I think things have changed a lot now. I tried running this sample, but the dependencies were old (wrangler v1) and I didn't know how to migrate them....

Can I notify a websocket server DO so that it can message it's connected clients?

I want to notify the server when work is done so clients can be notified

TypeScript node:crypto timingSafeEqual function not found

I'm trying to implement Twitch EventSub webhook handler in my Worker based on Twitch example code https://dev.twitch.tv/docs/eventsub/handling-webhook-events/#simple-nodejs-example It uses crypto library functions createHmac and timingSafeEqual Reading cloudflare docs I understood that I need to use node:crypto and the docs says that both createHmac and timingSafeEqual are supported in https://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/...

New Rate Limiting Binding - Impossible To Add New ENV Variables?

I just noticed this morning that if you’ve hooked up the new unsafe binding to the rate limiting feature… You cannot add ENV variables in the CF Dashboard. It always errors out with:...

Having some worker functions in a subdirectory of a existing project

Hello. I want to deploy some functions to cloudflare workers from a existing node-js project that I have. Every tutorial about workers/wrangler starts with "create a new project" so I am not sure what is the way of adding it to a subfolder of an existing node-js project. Any guidance or pointers to existing resources will be welcome.

Communication with local system via websocket

Hello, I need following. I have a Worker running. This worker needs access to a rest api in an local network which isnt exposed. The plan is to write a program like a gateway which runs locally and is 24/7 connected to the worker via a websocket. When I send a "task" like "GET the json from http://exampleservice.local:8121/exampleendpoint/" the gateway queries the data and responds to the worker also via the websocket. So i would be a async call. ...

Cloudflare worker for generating thumbnail of R2 video

Hello All, Is there any way possible in the worker script where I can generate thumbnail of a video which is uploaded to the R2 bucket?...

js worker wrong response

{"webSocket":null,"url":"https://dd.completions","redirected":false,"ok":true,"headers":{},"statusText":"OK","status":200,"bodyUsed":false,"body":{"locked":false}} What is the reason? I can use postman to request the https interface normally, and there is no problem with the certificate, but js worker fetch always returns an error. what reason make...

Error 1101 Worker threw exception all pages/workers

Hi all, I facing the issues all my pages and workers throwing Error 1101 Worker threw exception all of a sudden, anyone facing this or know why this happen?

rpc text stream

Does this make sense to do like this if this code is running in a method meant to return over RPC to another worker? ```javascript const chatCompletion = await openai.chat.completions.create({ model: 'gpt-4o',...

Toucan API - Correct way to use it?

I have been creating my sentry instance as such: ```javascript const sentry = new Toucan({ dsn: env.SENTRY_DSN, context: ctx,...

Using workers to compress images and upload back to R2 Bucket.

I'm using the worker script for compressing the image uploaded on the R2 bucket. I have setup the event using wrangler cli for pushing the event in a queue. I'm consuming the queue data in the worker script. My script creates a presigned URL and fetches the image from the bucket, it then compresses the image using jimp pacakge and then uploads it back to the bucket. Everything works well until the image size is less than 3 MB. As soon as it crosses that size, my worker starts failing. Can you please help me with this as I need to move my code to production environment ASAP. Since there is no direct support for the AWS S3 sdk, I had to use aws4fetch package to generate the presigned URL. Also there is no direct support for nodejs sharp package that is why I had to use Jimp package....

Does Smart Placement support Hyperdrive? I'm using Next.js with Postgres

I successfuly deployed a page using Next.js with next-on-pages connected to a Postgres database using Drizzle/Postgres.js and Hyperdrive. Everything works, except that the latency is still very high. I have enabled Smart Placement but it still takes >700ms to respond on a route with just one simple database query. My current deployment on Kubernetes takes ~150ms to do the same. (I'm measuring round trip to my pc). The "cf-placement" header shows that Smart Placement didn't trigger. Does it work...

service bindings typescript

https://developers.cloudflare.com/workers/runtime-apis/rpc/typescript/ suggests to define your own Env interface which would be incompatible with auto-generated worker-configuration.d.ts. Do I have to sacrifice npx wrangler types and define it manually if I use service bindings? It generates generic Fetcher type: ``ts // Generated by Wrangler on ... // by running wrangler types` ...

can't access worker from Russia: timeout and connection reset

so, i just created a worker (for now - just a Hello world), it is https://cbr-currency-shim.peajackboatan.workers.dev BUT i can't access it (timeout, connection reset). cloudflare status says thats all ok, but it is still doesn't load. also, dashboard says that there were no requests, so it is not issue with my code

Argo Smart Routing Breaks Workers

I want to use smart routing for my workers, because sometimes it's very slow +500 ping. But when I use smart routing, it throws CORS errror. It works just fine with workers.dev domain.

Works on local, canceled on Worker. Why?

Hi! I'm working on a discord bot that i'm running on workers. The same code executed locally works, but on a worker it gets a CANCELED outcome and I'm struggling to understand why. There's a not of helpful info attached to it, nor am I abel to find any documentation related to it. What causes the outcome to be CANCELED?...

cloudflare capchat bug

Hello cloudflare capchat no longer works for me, it loads accommodation and updates the page inifnie or displays a Failure. What should I do ?

sending video

hi so I have a large db of mixed img and vid, and Im currently trying to send the randomly seleced media to the user, when I got an img the server sent everything fine, but when I got vid the servers tries to fetch the domain again which gave a random media (img/vid), is there any way to prevent this? ```export default { async fetch(request, env) { const url = "db"; const response = await fetch(url);...

Spike in automated traffic detected

i received this email but the button on it goes to a 404 my guess is because it’s a worker domain and not custom one that this page isn’t accessible. it’s also weird that there’s no link to the traffic graph or anyhing just a link to enable super bot fight mode....