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

Bug in Wrangler - it randomly adds [object Object] to console.log()'d string output

I think I've raised this before but didn't get anywhere. There's a really weird bug in Wrangler (presumably) whereby, when you console.log() something, if it's over a certain lenght (unclear), Wrangler malforms it and swaps parts of it out for [object Object]. So you'll get something like:...

Is there a way to specify the wrangler file directory?

I'm trying to deploy a static react app to cloudflare pages in a monorepo, everything works but it can't find the wrangler file because it's in a child directory, not the monorepo root.

Uncaught Error: No such module "node:buffer". imported from "worker.js" (Code: 10021)

The title sums it up, also I tried both the nodejs compatibility flag and the new experimental v2 one.

522 error in Cloudflare Workers production

Hey, I'm getting a 522 error on a fetch request in production but everything is running fine locally. Has anyone had this experience? I'm using a reverse proxy and using the FREE workers plan. On a get request I'm fetching a HTML element from another path. It is here that I am getting the 522....

Mailing from worker

I read this page https://developers.cloudflare.com/email-routing/email-workers/enable-email-workers/ and can non found Email setting "Go to Email > Email Routing > Email Workers." in Cloudflare panel. Also I found this page - https://developers.cloudflare.com/email-routing/email-workers/send-email-workers/ - is it working? What I need to set up to allow this function? Where is page to verify Email address? I can not found it in Cloudflare panel. Alternatively I have access to external mail server, but Nodemailer not working with Cloudflare. Some peoples said that is exist setting 'Node-compability' for worker. I try to add this setting to TOML setting file, but nothing changing - Nodemailer still not compiled with worker. So, how I can send mail from Cloudflare Worker?...

UnknownError started appearing. Looks like an internal error

Hi Cloudflare, I started seeing this error for the first time. Happened in a spurt of ~10 at the same time and hasn't happened since but will report back if it does. Was seeing about a steady 500-600RPS at the time that it happened and doesn't correlate with any deploys. Logs show that the worker executed but failed with: ```...
No description

Workers rate limit working only locally

I'm trying to use the rate limit on workers: This works on wrangler dev (local server) but it does not on the cloud. When I try console logging the binding name after triggering the worker fetch, I get an empty object {} for the binding object. The same thing on local has limitVal , period etc which is the rate limit config from wrangler.toml. Has anyone else faced something similar?

Node Http2 request to another origin

Does Cloudflare worker support request to outsource Http2 ? - I want to use node:http2 request to APNs ```javascript import http2 from "node:http2"; //Cannot find module 'node:http2' or its corresponding type declarations. const session = http2.connect("https://api.sandbox.push.apple.com:443");...

Error: Unable to delete cached response

Hi, I just came upon this issue when moving my app to production, I don't have this issue in local or preview environments, only production! The cache.delete(key) throws an exception on a key that exists in the cache, so my cache keeps sending a stale response and I can't remove it to have cache updated with newer response......

How to modify websocket request before sending it to durable object

I currently call:
durableObject.fetch(request)
but I want to send it like this:
durableObject.fetch(modifiedRequest)...

Masking(hide) d1 uuid on wrangler.toml

I am building a worker in Teamcity. Therefore, you need to upload the wrangler.toml file to git. I would like to ask whether D1's UUID should be hidden, or if so, what should be done. For security reasons, I think D1's UUID should be masked. I'd like to ask what you think....

Sub Domain

Hi! I’m beyond new to this sort of stuff and I would assume what I’m going to ask if quite stupid. So I purchased a domain via Regery and I have swapped the name servers over to cloudflare but how do I set up a sub domain so I can receive the incoming emails to that uncreated sub? I’m just having a nightmare and I think I’m just struggling at what to search #workers-help...

With function calls, are system messages or description properties preferable to instruct AI?

I realise that title is not super clear. Basically I've found that both of the following function calls produce the same result. One users a type=system message to instruct AI, while the other omits this and instead provides description properties. If I do neither approach, I get erroneous/extra results from just the two bits asked for (fruit + vegetable). Which is preferable, according to how this functionality is designed? Version 1 - with system message ``` const response = await env.AI.run('@hf/nousresearch/hermes-2-pro-mistral-7b', {...

AI embedded functions calls - how can my function influence the AI response?

I'm playing around with CF AI Functions and came up with this. The user message passed to AI hints at a fruit, AI infers the fruit as an orange, and sends "orange" to my function. So far, so good. ``` import { runWithTools } from '@cloudflare/ai-utils'; router.get('/ai', async (req, env) => { const fruit = ({fruit}) => {...

Worker script gets minified twice

I got a weird error where a JSX rendered in prod doesn't have correct html line breaks. Upon further inspection I discovered that when code that's been previously minified by esbuild gets deployed to workers it somehow misses ALL line breaks in string literals which causes the issue. I'm using a custom JSX renderer, that's why it wasn't caught earlier I think. It is a requirement for the project. The code is deployed using Cloudflare API. Any suggestions how to fix this?...

Dynamic image rendering with Workers

I'd like to use Cloudflare Workers to dynamically create and serve images, but all of the rendering packages I've found have native dependencies or otherwise don't run on the Workers platform. Tom Sherman's approach (https://tom-sherman.com/blog/dynamic-og-image-cloudflare-workers) is close to what I'd like but I'd rather not use the browser rendering API if possible...

R2 via workers returnind undefined for list, get, delete and put requests

I have everythin in 'modules' to organize the code better index.js pageHandler.js corsHandler.js ...

Worker not accepting POST connections from outside Cloudflare.

The title is pretty self explanatory, after trying to call a URL with the POST method, it shows like the request went through but they did not go through as the value on the temp page that should change from false to true stays the same. If you need full code to test (not screenshots) send me a DM and I'll hook you up with the code.
No description