Mitya
CDCloudflare Developers
•Created by Mitya on 2/21/2025 in #workers-help
Several questions about developing locally with queues
1. The Get started guide for queues suggests running
wrangler tail
to watch published messages arrive. However this gives an error 10007 when working locally. Should this command work locally?
2. How does one configure the batch size/frequency of a queue when working locally, since the queue is automatically-created by Wrangler? That is, you don't run the create
command when working locally, nor do you bind the queue explicitly to your config TOML/JSON.
3. In my consumer handler, I have:
Note I'm not running message.ack()
. I expected that this would result in the consumer repeatedly re-receiving the same message (because I never acknowledged it). But this doesn't happen; the console message shows up only once. Am I mistaken here?
4. Is there any ETA on queues being supported with the --remote
flag? This would make life MUCH easier - right now developing with queues is really quite painful.
Thank you in advance.2 replies
CDCloudflare Developers
•Created by Mitya on 2/13/2025 in #workers-help
Getting lots of CF errors while working locally with `--remote`
Way more errors than usual today that don't seem to result from anything I'm doing in code. Here's two of the errors I'm seeing frequently. I have to restart the Worker each time.
and
4 replies
CDCloudflare Developers
•Created by Mitya on 1/30/2025 in #workers-help
Do workers invoked by service binding get a fresh 30 seconds?
This has crept up in various discussions but I don't believe there's been a definitive answer from CF staff on this and the docs seem (at least to me) unclear on the point.
If worker A (triggered over HTTP) invokes worker B via a service binding and
waitUntil()
, must worker B fulfill its job within the original 30 seconds afforded to worker A, or does it get its own, fresh 30 seconds?
In other words, which of these is correct, if worker A invokes worker B after 20 seconds?
1. Worker B has 10 seconds remaining to do what it needs (the whole operation is subject to worker A's 30 seconds)
2. Worker B has 30 seconds remaining to do what it needs (the whole operation takes 50 seconds)3 replies
CDCloudflare Developers
•Created by Mitya on 1/30/2025 in #workers-help
How do I specify producer and consumer workers in TOML under an environment?
TOML continues to hurt my head and I'm struggling to bind queues within an environment. I've tried the following (both suggested by Cursor but both apparently wrong):
and
What's the correct syntax here?
4 replies
CDCloudflare Developers
•Created by Mitya on 1/30/2025 in #workers-help
Service bindings - do I need to use waitUntil() in this scenario?
Suppose I have a service binding from worker A to worker B. Worker A is triggered over HTTP, and hands off to worker B to do a task e.g. update a DB record or call a remote API.
Worker A does NOT need to know the result of worker B's task - it simply kicks it off. Worker A is then free to terminate. In this scenario, do I need to use
waitUntil()
in worker A or not? Struggling to understand when waitUntil()
is and is not required.
Thank you in advance.8 replies
CDCloudflare Developers
•Created by Mitya on 1/29/2025 in #workers-help
Can I run two workers from one monorepo?
I'm sure the answer is yes; I'm just wondering what the set up here would look like. If my repo was:
...how would I configure the action to read from those two top-level directories and build two distinct workers? Or would I need some sort of top-level Wrangler file? Just unable to visualise this.
9 replies
CDCloudflare Developers
•Created by Mitya on 1/23/2025 in #general-help
Zero trust says my cert is expiring, and that's it's in use. But by what?
I generally understand little about certificates. I've never thus far used Zero Trust but today I went to it and got a notification that my cert was expiring, and I should generate a new one. This I've done, but it says the old one is "in use". But it doesn't say by what. Do I need to do anything here, or update my CF domains/workers/pages apps or whatever? I realise this is vague but any help appreciated!
7 replies
CDCloudflare Developers
•Created by Mitya on 1/9/2025 in #workers-help
Hyperdrive fails to connect in `scheduled()` (but works over HTTP)

8 replies
CDCloudflare Developers
•Created by Mitya on 1/6/2025 in #workers-help
"SyntaxError: Unexpected end of JSON input" in wrangler-dist/cli.js
This has happened a few times recently for me, after making some innocuous code changes. Restarting my PC seems to get rid of it, but it's annoying and I'm not sure what's causing it. Anyone any idea? Thanks in advance.
18 replies
CDCloudflare Developers
•Created by Mitya on 1/6/2025 in #workers-help
With the `scheduled` handler, what's the difference between waitUntil and just using async/await?
Is it necessary to use
waitUntil()
when I could just use good old async/await to delay termination of the worker?20 replies
CDCloudflare Developers
•Created by Mitya on 1/4/2025 in #workers-help
Another worker vs. workflow for background work?
We need to vectorise some user input to our worker, and my idea was to have a separate worker, via a binding, that could do this task without holding up the main worker that receives user input and gives output. I can do this via
waitUntil()
. However I just discovered Workflows and this sounds like much the same thing, suited to the task. Which would be better in my case and what are the key considerations?
Thank you.2 replies
CDCloudflare Developers
•Created by Mitya on 12/12/2024 in #workers-help
Can AI Functions work effectively with multiple inputs that it needs to iterate over?
I have a simple AI Function setup that's working. It extracts a couple of bits of info from the user message and returns them as arguments for my function. So far, so simple.
What I'm struggling to do (and this may not be possible) is to get it to perform well with multiple inputs.
Suppose my user message was this - a JSON-formatted array of user messages, and I wanted to extract the sentiment and categories for each one:
I'm struggling to sest up the
tools
> parameters
> properties
section such that it can report on each message in the input. I've tried something like:
Sometimes this sort of works and at other times it just gives nonsensical responses or breaks down. I've also tried asking it to give me an object of params per message, like so:
...but this rarely works out well. Is there a better way here?1 replies
CDCloudflare Developers
•Created by Mitya on 12/12/2024 in #general-help
Why isn't my cname showing up in DNS checkers?

5 replies
CDCloudflare Developers
•Created by Mitya on 7/25/2024 in #workers-help
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 a fix planned for this? It makes debugging quite difficult. The only way I've found to get round it is to do console.log(encodeURIComponent())
, which seems to avoid the problem.4 replies
CDCloudflare Developers
•Created by Mitya on 7/21/2024 in #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
Version 2: with description properties
Thank you in advance.4 replies
CDCloudflare Developers
•Created by Mitya on 7/20/2024 in #workers-help
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.
What I don't know is how to get my function to influence the response. As you can see, my function returns "**", which I thought might implicitly form the AI's response. It doesn't; AI responds in its own wording. Is what I'm trying to do possible?
1 replies
CDCloudflare Developers
•Created by Mitya on 6/21/2024 in #workers-help
Can I write a data URI to an R2 bucket?
Is it possible to write to an R2 bucket with a base64 data URI i.e.
? That fails (it creates a text file with literally that content), but perhaps there's a way to encode the file contents first such that R2 accepts it?
7 replies
CDCloudflare Developers
•Created by Mitya on 6/21/2024 in #workers-help
How to validate a file upload in Workers before saving it to R2?
I've spent ages trying to resolve this. I know how to upload a file and save it to R2. What I can't figure out is best practice to validate the file first.
Lots of resources out there say use something like Formiddable, but I can't believe I need a third-party library just to enforce things like "must be a PDF" or "must be under 100kb".
I know the Workers R2 API allows the stipulation of conditions on PUT operations, but these conditions don't seem to relate to the sort of conditions I mention above.
So what's best practice here?
11 replies
CDCloudflare Developers
•Created by Mitya on 6/17/2024 in #workers-help
All of a sudden Wrangler keeps opening a browser tab and asking for account access?

20 replies
CDCloudflare Developers
•Created by Mitya on 5/24/2024 in #workers-help
Deployment via GH Action sometimes gives error about NPX failing with "exit code 1"

3 replies