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

Alternative to Workers that allows use of XMLHttpRequest

So I just needed to create an endpoint for this project I'm building, and in the endpoint I make a call that happens to make a XLMHttpRequest, does cloudflare offer an alternative resource that would let me make the call? Or do I need to create a serverless function with vercel and call that endpoint it wouldn't be ideal, but seems the only way to solve my problem currently, unless there are different serverless functions within Cloudflare that can handle XMLHttpRequests.

Webhooks, Websocket, SMTP and Drums, Push API with Workers

Well, I'm quite new to workers in general. I've managed to do what I originally planned so this is just me wanting to learn/try new stuff. Ok #1 is: I'm using Contentful which allows me to add Webhooks so I did. It makes a POST request to an specified URL, the worker gets the post request, formats the data and for now, just puts it in console.log. So in short, I make an entry in Contentful, Webhook, Workers gets it Here's the question, how can I make the backend interact with the frontend when a new request has been received? So when a new entry is made, the end result is, just for now, a console.log on the actual frontend (I can handle the rest, it's just the connection between both)...

Workers Build "unlimited" builds not unlimited?

All my worker builds are "queued" and even if I attempt to re-trigger them, they're stuck in "queued". According to the workers beta docs, there are no limits to workers builds during beta, why would all my builds be stuck? (we're on a Pro plan btw"...

What do you use to hash passwords on Cloudflare workers?

I've tried @node-rs/argon2 and node-argon neither of which seem to work.

Brotil compression not active.

I'm in the process of rewriting my web application and migrating it from Pages to Workers however, after checking the metrics from the Workers version vs the Pages version I noticed that Brotil, GZip or any other compression system isn't active on my worker. Is this intended behaviour?...

Force country

I need to make a fetch request to external API that accepts only Netherlands ips. How do I run a worker only in AMS datacenter and not the user’s closest datacenter, so I could make a fetch request? I heard of resolveOverride hack but I dont get it how to set it up???...

Browser Rendering Env Binding in local dev is not set?

In my local wranger dev I can see logs saying it will bind browser but when I print out env from fetch or queue param its undefined. I assume it's why I am seeing this error trying to launch puppeteer.
const browser = await puppeteer.launch(env.CRAWLER_BROWSER);
const browser = await puppeteer.launch(env.CRAWLER_BROWSER);
...

Error: [unenv] fs.readFile is not implemented yet when getting presigned url with s3 packages.

I am trying to get a presigned put url for my R2 bucket, but getting the above error when getSignedUrl is executed. ```ts ...

Nest.js as Worker

Hello, has anyone had luck hosting Nest.js applications as a Worker on Cloudflare?

Connect a worker to AWS VPC via Tunnel

Hello, is it possible to connect a Cloudflare worker to my AWS VPC through a Cloudflare tunnel? I haven't seen any documentation about this other than the statement that a tunnel connects a private network to cloudflare network which sounds like it could allow workers send requests to an endpoint within my AWS VPC. Is that possible? and if yes, is there any documentation on how we can enable it?...

Simultaneous outgoing requests limit workarounds

Hello, I have cron trigger every minute that polls data from devices (meters, routers, cameras, and some cloud apis) across multiple locations, some take a while to respond and I'm looking for a way to go around the 6 outgoing requests limit. I saw in the docs that even If I split the workload across many workers via bindings this limit applies the same (wish there was a way to configure this even if I'm billed another worker invocation). I was thinking maybe one way was to have different workers each with a cron trigger that spawns the same worker for different types of device, but feels hacky, wondering if any of you have experience with something similar....

Mock fetch in vitest tests using unstable_dev

Hi! I've got an application that uses durable objects in wrangler workers. I'm trying to write some integration tests using unstable_dev , and it works fine until I need to fetch from an external service, which obviously fails. I've tried all possible ways to nock/mock/intercept these requests. I even tried to mock the method that calls fetch inside a class instance, but nothing works. I was wondering if anyone had any ideas? I looked into using @cloudflare/vitest-pool-workers, but it forces me to set compatibility_flags = ["nodejs_compat"], which I would prefer not to do. Still, I did give it a go, but I get a weird typescript error, _os.platform is not a function. Any help would be very much appreciated, I've spent so many hours on this and I don't know what else to try...

How to point Worker & NextJs app to the Same Local D1 Clone SQL File

I am using monorepo in my NextJs project i have 3 folders inside my apps folder 1. apps/web : my Nextjs Project hosted on cloudflare Pages 2. apps/linkp-worker: my cloudflare worker to assist my main application...

Local development proxy example getting a middleware error

Hey all, I'm having this issue trying to create a worker that will work as a reverse proxy for 2 applications. Here is the simplified logic I am using: ```ts export default { ...
No description

Deploying Existing Next On Pages App to Workers.

I have an existing nextjs app that works using cloudflare next on pages but when deployed to workers using the opennext adapter it fails to load the pages successfuly. The logs show an error with the instrumentation.ts as a dynamic import. Removed that file to see if that would solve it but the issue remains...

🌎 Workers Browser Rendering Puppeteer Geolocation

I've created and deployed a Cloudflare Worker that uses Browser Rendering and Puppeteer to crawl a website. My issue is that the website content is based on the IP location of the Cloudflare Server location, and not the user making the call. ❌ There is no way of adding a query parameter to the actual url to adjust the locale (gl/hl). ❌ I've tried to solve this on the Puppeteer level, by implementing various techniques from here, including setGeoLocation: https://zirkelc.dev/posts/puppeteer-language-experiment...

D1 in workers constant query errors & timeouts

starting around 8 hours ago today, I started receiving a bunch of these two errors and queries started timing out or taking far longer than usual. Does anyone know a way to fix? ``` Error: Error: D1_ERROR: D1 is overloaded. Too many requests queued. Error: Error: D1_ERROR: D1 is overloaded. Requests queued for too long....

How to rate limit per hour?

I'm expecting bursty behavior so a per-user limit of 25 requests/hr seems ideal

Worker Schedule via Dashboard BUG?

I've noticed when editing a worker with a scheduler via the Dashboard the edits aren't applied to the worker even when Deployed, you need to reload the whole dashboard in order for it to become enabled. Versus for HTTP Requests where you have the SEND/Reload button to load new edits to the Worker..