Repository navigation
fix(void): log queue handler errors instead of dropping them - #629
Open
morinokami wants to merge 3 commits into
Open
morinokami wants to merge 3 commits into
morinokami wants to merge 3 commits into
Conversation
The generated __processQueue caught a handler's error without binding it,
so the reason a batch failed was lost: Cloudflare recorded only
"queue: Handler failed.", and the dev server and Void Cloud got
{"ok":false} with nothing logged. Log the error with the handler file
and queue name, as scheduled() does for jobs. The native queue() also
logs why no handler matched a queue, a reason only the HTTP route
passed on. The framework wrapper's HTTP relay logs handler errors too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8F8mceGgtLyricGiHmQNt
When no handler matched a queue, only the native queue() logged the reason. The HTTP route returned it as `error`, which the Void Cloud relay ignores, so a batch for an unknown queue was retried with nothing logged. Log the reason in __processQueue, where handler errors are logged, and drop the native queue()'s own log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8F8mZUqZxveCneED8EgLC
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a queue handler throws, its error is never logged. The generated
__processQueuecatches it without binding it (} catch { __ok = false; }), so the reason is lost on every path:queue()throws a newError("queue: Handler failed."), and Workers Logs andvoid project logsshow only that./__void/queueanswers{"ok":false}, and nothing reaches the terminal.{"ok":false}and retries the batch, and nothing is logged.The generated
scheduled()already logs a failing job's error ([void] Scheduled job … failed for cron "…").__processQueueinpackages/void/src/router/compile.tsnow does the same for queue handlers before marking the batch failed, which covers all three paths. When no handler matches the queue,__processQueuereturned the reason only aserror, which the nativequeue()dropped and the Void Cloud relay ignores, so it now logs that reason too.handleQueueRelayinpackages/void/src/cli/wrapper.tshad the samecatchand now logs too. The wrapper's nativequeue()already lets errors through, and the framework dev trigger already logs them ([void] queue handler threw:).The thrown
queue: Handler failed., the{ ok: false }result and the ack/retry decisions are unchanged.docs/guide/queues.mdnow says the handler's error is logged.Repro
queues/fail.ts:{"ok":false}, andboomis logged nowhere.[void] Queue handler queues/fail.ts failed for queue "fail": Error: boomwith its stack. A message sent through the queue binding (Miniflare's native delivery) logs the same line.Tests
packages/void/test/integration/queue-dispatch.test.ts: the error a handler throws reachesconsole.erroras the same object, with its file and queue, through__processQueueand through the nativequeue(). Both also log the reason for an unknown queue.packages/void/test/unit/wrapper.test.ts: the same for the wrapper's HTTP relay.