[workers-utils] Report a non-array queues.consumers as a config error instead of crashing - #15010
Conversation
🦋 Changeset detectedLatest commit: 6aee712 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
8fdfa9c to
05178f3
Compare
|
Hi. We are not accepting PRs that don't have an associated issue. Please could you open an issue with a reproduction first. Thanks. |
|
Understood, and sorry — I should have read CONTRIBUTING.md more carefully before opening these. I'll write up an issue with a reproduction and link it here. I have five more fixes in this repo staged locally. I've stopped filing them; I'll open issues for those instead and wait, rather than send more PRs. |
|
Issue with reproduction: #15069 |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Thank you very much for the fix (and the issue and everything) @LeSingh1 🙂
I've accepted devin's changeset suggestion, besides that all else looks good to me 😄 💪
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
48f0137 to
52303f1
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
We recently landed #14994, a large change to Miniflare's configuration internals that touched ~177 files across the repo. Leaving this PR on its old base was likely to cause conflicts, so we've rebased it onto the latest Your local copy of this branch is now out of date. Before you push again, please reset to the new version: git fetch origin
git checkout fix/queues-consumers-not-array
git reset --hard origin/fix/queues-consumers-not-arrayBecause the base moved a long way, it's also worth reinstalling before you carry on — the lockfile changed: pnpm installSorry for the interruption. If the rebase looks wrong, or CI now fails in a way that seems related to the Miniflare config change rather than your own work, comment here and we'll help get it sorted. |
|
The red CI here is not caused by this change — it needs a rebase onto The failure is a workerd compatibility-date rollover:
This branch pins Evidence:
Worth noting for anyone skimming: the failing file is Also flagging the underlying fragility: because |
52303f1 to
a1633ca
Compare
a1633ca to
b5038c3
Compare
`validateQueues` recorded the `should be an array` diagnostic for a non-array `queues.consumers` but then fell through to the `for` loop instead of stopping, so the diagnostic it had just prepared never reached the user. `"consumers": null` threw `TypeError: Cannot read properties of null (reading 'length')` out of config validation, and `"consumers": "my-queue"` iterated the string's characters, emitting one spurious `"queues.consumers[N]" should be a objects` error per character. Guard the loop behind the array check, matching `queues.producers`, which returns early via `validateBindingArray`.
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
b5038c3 to
6aee712
Compare
validateQueuespushes the "should be an array" diagnostic for a non-arrayqueues.consumers, but then iterates the value anyway — there is noelseor early return. The diagnostic it just prepared never reaches the user.With
consumers: null:With
consumers: "my-queue"the string is iterated character by character, so the real error is buried under one spurious diagnostic per character:Guarding the loop behind the array check lets the intended diagnostic surface on its own.
Note
This is a contribution from an AI agent: Claude Code (Claude Opus 4.5), working on behalf of @LeSingh1. Review comments will be read and responded to.