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

How to access to binding variables during nextjs build process?

I'm trying to user D1 with drizzle orm in next js, currently using next auth 5, and using drizzle adapter for that.. How to get the DB instance during build? export const { handlers: { GET, POST }, auth, signIn,...

Enable workers.dev route for worker deployed via API

I'm using the API here to deploy a worker via the API: https://developers.cloudflare.com/api/operations/worker-script-upload-worker-module However, after the worker has been deployed, it will not be accesible at its ...workers.dev url. I can enable it in the dash, but I want to enable it also via the API. I can't find the right API call to do this. With a bit of haxxing, googling, and intercepting traffic from the dash, I have come up the following, which actually works, but I can't find any info about it: https://api.cloudflare.com/client/v4/accounts/...account_id.../workers/services/...script_name.../environments/production/subdomain...

Deploying Workers via API

Where can I find the documentaion for how to deploy a worker via a REST API (i.e. not using wrangler). I found this thread: https://community.cloudflare.com/t/deploy-a-worker-via-http-api/108439/14 pointing to this url: https://developers.cloudflare.com/workers/tooling/api/scripts/#upload-or-update-a-workers-script but it seems to no longer be working. What is the current url?

How many workers are running?

Is there a way to see how many worker instances are running for my site? I'm running an in-memory cache, and just trying to estimate what the cache hit rate will be.

Send many emails at once

I am using the mailchannels api, and sending an email to each user in an apppintment when it’s approved. The user count could be up to 30. Since workers has a network request limit of like 10 (I think), will most of these emails fail (I also have D1 operations happening in the same worker). I can’t tell if they will fail or if they will just be delayed (that’s fine)...

Messages in Queue not Processing

Messages in a queue have suddenly stopped processing. I'm able to see the messages, produced by a producer worker with a json body, but the message seems to never hit a consumer.
No description

browser rendering

Trying to experiment with https://developers.cloudflare.com/browser-rendering/get-started/reuse-sessions/ have a paid plan and only 1 worker when across my account.. When i deploy locally i keep getting this error ✘ [ERROR] Uncaught (in response) Error: Unable to create new browser: code: 429: message: Too many browsers already running ...

Can't figure out how to promote a preview environment to production

This is silly but I can't figure this out. I'm in the Cloudflare dashboard and according to the docs there should be a way to either manually promote a preview environment to production or to add a git integration and neither of these options are in the UI.
No description

Issue with FormData Methods in Cloudflare Workers

I am currently developing an API using Cloudflare Workers and have encountered a technical issue with handling FormData objects. Specifically, I am unable to use the form.getBuffer() and form.getBoundary() methods as they are seemingly not recognized as functions. Here is the relevant part of my code: ```javascript const form = new FormData(); form.append("manifest", JSON.stringify(manifest), {...

How do I view console.log output?

What's the easiest way to do this? And why isn' it on by default? The live logging feature (e.g. wrangler tail) only logs http events.

Hello World Worker flow question

Hi here's the truncated output of creating a hello world worker. I had expected with this flow that I'd have a repository named "worker-demo" be created but there isn't one. git is set up properly in my environment I have dozens of other projects around. What do I need to do to get the git part working? ``` ➜ expts npm create cloudflare using create-cloudflare version 2.21.1...

how to setup session to handle Google login oauth flow on workers

After successful login, what is the recommended way to store session or cookie on worker ?

Logging

I'm wondering what others are using for application level logging? Just console.log ? I woud like to enable some custom logging statements based on the environment, like log.debug, log.warn Has anyone tries libraries like Winston or Pino on workers? Is there a recommendation?...

How to get the name of a durable object

I'm creating durable objects via this.env.SWARM.get(this.env.SWARM.idFromName(HEX_STRING)) But when i call this.ctx.id.name inside the object it is undefined. Is there a way to get name -- or associate other state with the object during its construction/instantiation?...

Does Workers AI support service worker?

I’m trying to integrate AI into my workers, after I added ```toml [ai] bindings = 'AI'...

How to broadcast message to all active websocket connections?

When I try to store the WebSocket object in an array and call send() on each of them I'll get ``` Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be...

RPC Durable Object not working

Can somebody help me finding out why my RPC Durable Object is not working (locally, newest wrangler)? I basically have this (simplified) setup: ```ts export class Example extends DurableObject { constructor(ctx: DurableObjectState, env: Env) {...

We're using the API to tear down workers but their KV bindings are not being torn down with them.

This leads to a deleted worker but its KV namespace hangs around:
await cf.workers.scripts.delete(script, { account_id })
await cf.workers.scripts.delete(script, { account_id })
How can we cascade delete the KV namspace?...

Two tunnels - one customer - one tunnel doesn't let me rdp - other one does.

I have setup Cloudflare for a customer and it works beautiful. she has a windows 10 workstation in azure for $19 and she uses Cloudflare for a non public ip. her systems at her office have zero trust and connect to the domain and allow her to access the applications in azure. outstanding.
I now need to do the same thing for a small system that is at her office (not in azure). I setup a new tunnel and installed the agent on a 192x.x.x ip. I can see the tunnel is healthy but am not able to rdp to 192x.x.x ip. What am I missing? It appears when I do a tnc 192x.x.x while connected to zero trust, my system tries to stay inside the network and not use cloudflare. Any ideas would help. Thank you in advance....

Need help in setting up queue in workers

hey I am creating a simple worker to get html code of websites, I want to create a worker which gets urls from local json file, and send them in a queue this queue then invoke other worker which will do the rest, I read documentation but found that i have to do it in a single worker fucntion, I can undersatnd anything there, please help me how to do this?