Skip to content

[workers-utils] Report a non-array queues.consumers as a config error instead of crashing - #15010

Merged
petebacondarwin merged 2 commits into
cloudflare:mainfrom
LeSingh1:fix/queues-consumers-not-array
Aug 14, 2026
Merged

petebacondarwin merged 2 commits into
cloudflare:mainfrom
LeSingh1:fix/queues-consumers-not-array

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

validateQueues pushes the "should be an array" diagnostic for a non-array queues.consumers, but then iterates the value anyway — there is no else or early return. The diagnostic it just prepared never reaches the user.

With consumers: null:

TypeError: Cannot read properties of null (reading 'length')
    at src/config/validation.ts:5116

With consumers: "my-queue" the string is iterated character by character, so the real error is buried under one spurious diagnostic per character:

- The field "queues.consumers" should be an array but got "my-queue".
- "queues.consumers[0]" should be a objects, but got "m".
- "queues.consumers[1]" should be a objects, but got "y".
... (6 more)

Guarding the loop behind the array check lets the intended diagnostic surface on its own.


  • Tests
    • Tests included/updated
  • Public documentation
    • Documentation not necessary because: this corrects validation error reporting only; no config surface or API changes.

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.


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6aee712

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@cloudflare/workers-utils Patch
@cloudflare/autoconfig Patch
@cloudflare/cli-shared-helpers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/remote-bindings Patch
@cloudflare/workers-auth Patch

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Aug 4, 2026
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team August 4, 2026 04:03
@workers-devprod

workers-devprod commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15010

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15010

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15010

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15010

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15010

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15010

miniflare

npm i https://pkg.pr.new/miniflare@15010

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15010

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15010

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15010

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15010

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@15010

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15010

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15010

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15010

wrangler

npm i https://pkg.pr.new/wrangler@15010

commit: 6aee712

@jamesopstad

Copy link
Copy Markdown
Contributor

Hi. We are not accepting PRs that don't have an associated issue. Please could you open an issue with a reproduction first. Thanks.

@jamesopstad jamesopstad closed this Aug 6, 2026
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Aug 6, 2026
@LeSingh1

LeSingh1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

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.

@LeSingh1

LeSingh1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Issue with reproduction: #15069

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Aug 7, 2026
@petebacondarwin
petebacondarwin force-pushed the fix/queues-consumers-not-array branch from 48f0137 to 52303f1 Compare August 12, 2026 06:32
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@petebacondarwin

Copy link
Copy Markdown
Contributor

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 main and force-pushed the result.

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-array

Because the base moved a long way, it's also worth reinstalling before you carry on — the lockfile changed:

pnpm install

Sorry 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.

@petebacondarwin

Copy link
Copy Markdown
Contributor

The red CI here is not caused by this change — it needs a rebase onto main, not a re-run.

The failure is a workerd compatibility-date rollover:

FAIL test/validation.test.ts > resolves relative runner and auxiliary worker rootPath before conversion
AssertionError: service core:user:vitest-pool-workers-runner-:
  This Worker requires compatibility date "2026-08-14",
  but the newest date supported by this server binary is "2026-08-11".

getTodaysCompatDate() is unclamped (packages/workers-utils/src/compatibility-date.ts:37 — just new Date()), so once the calendar passes the pinned workerd binary's newest supported date, this test fails.

This branch pins workerd: "1.20260804.1", whose newest supported date is 2026-08-11. main bumped to 1.20260811.1 in #15123 (landed 2026-08-12 09:55 UTC), which supports today.

Evidence:

  • I re-ran the failed jobs today — still fails with binary max = 2026-08-11, because a re-run reuses this branch's lockfile and therefore the old workerd.
  • The same suite is green on a current-main branch (20/21 test files passed on [wrangler] Omit mainModule for build-output entrypoints in wrangler types #15155).
  • Running that exact test locally against main's 1.20260811.1 passes today:
    ✓ test/validation.test.ts (8 tests | 7 skipped) 4605ms
      ✓ resolves relative runner and auxiliary worker rootPath before conversion
    

Worth noting for anyone skimming: the failing file is packages/vitest-pool-workers/test/validation.test.ts, which is unrelated to the packages/workers-utils/src/config/validation.ts this PR changes — the matching name is a coincidence.

Also flagging the underlying fragility: because getTodaysCompatDate() has no upper clamp, every branch whose lockfile lags a workerd release starts failing the moment the date rolls past that binary's newest supported date. That is a recurring CI trap independent of this PR.

@petebacondarwin
petebacondarwin force-pushed the fix/queues-consumers-not-array branch from 52303f1 to a1633ca Compare August 14, 2026 10:11
@LeSingh1
LeSingh1 force-pushed the fix/queues-consumers-not-array branch from a1633ca to b5038c3 Compare August 14, 2026 10:18
LeSingh1 and others added 2 commits August 14, 2026 13:32
`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>
@petebacondarwin
petebacondarwin force-pushed the fix/queues-consumers-not-array branch from b5038c3 to 6aee712 Compare August 14, 2026 12:32
@petebacondarwin
petebacondarwin merged commit 1b73c87 into cloudflare:main Aug 14, 2026
54 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

A non-array queues.consumers crashes config validation with a TypeError instead of a config error

5 participants