You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Astro v6.1.3
Vite v7.3.1
Node v25.8.2
System macOS (x64)
Package Manager npm
Output static
Adapter @astrojs/cloudflare (v13.1.7)
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When a project uses Cloudflare Queues (with queues.consumers in wrangler.json) and has a mix of prerendered and server-rendered pages, astro build fails with:
QueuesError [ERR_MULTIPLE_CONSUMERS]: Multiple consumers defined for queue "my-queue": "prerender" and "mre-prerender-queue"
The @astrojs/cloudflare adapter's prerenderWorker.config callback spreads the entire entryWorkerConfig into the prerender worker config:
// node_modules/@astrojs/cloudflare/dist/index.js, line 108config(_,{ entryWorkerConfig }){return{
...entryWorkerConfig,// <-- includes queues.consumersname: "prerender",};},
This copies queues.consumers into the prerender worker. Miniflare then sees two workers (the entry worker and the prerender worker) both consuming the same queue and rejects the configuration.
What's the expected result?
The build should succeed. The prerender worker only needs to render static HTML — it should not inherit queue consumer bindings from the entry worker.
Potential fix
The prerenderWorker.config callback should strip queues.consumers (and potentially other non-applicable bindings) from the prerender worker config:
config(_,{ entryWorkerConfig }){const{ queues, ...rest}=entryWorkerConfig;return{
...rest,name: "prerender",// Preserve producers but strip consumers so Miniflare doesn't// reject the config for having two workers consuming the same queue.
...(queues?.producers?.length&&{queues: {producers: queues.producers},}),};},
I was able to reproduce this issue. The @astrojs/cloudflare adapter's prerenderWorker.config callback spreads the entire entryWorkerConfig (including queues.consumers) into the prerender worker config. When Miniflare sees two workers (the entry worker and the prerender worker) both registered as consumers of the same queue, it rejects the configuration with ERR_MULTIPLE_CONSUMERS. The prerender worker only renders static HTML and has no need for queue consumer registrations.
I was able to fix this issue. The fix destructures queues from entryWorkerConfig in the prerender worker config callback, dropping queues.consumers while preserving queues.producers (which are just bindings, not consumer registrations). This prevents Miniflare from seeing duplicate queue consumers. View Suggested Fix
P3: minor bug. This affects users who use Cloudflare Queues with queues.consumers in their wrangler.json and have a hybrid site (mix of prerendered and server-rendered pages) using the default workerd prerender environment. This is a relatively specific combination of features, but it completely blocks builds for affected users with no workaround other than removing queue consumers from the config or switching to prerenderEnvironment: 'node'.
Description: When a project uses Cloudflare Queues (with queues.consumers in wrangler.json) and has a mix of prerendered and server-rendered pages, astro build fails with:
QueuesError [ERR_MULTIPLE_CONSUMERS]: Multiple consumers defined for queue "my-queue": "prerender" and "mre-prerender-queue"
The prerenderWorker.config callback spreads ...entryWorkerConfig directly into the prerender worker config, which includes queues.consumers. Miniflare then sees two workers both consuming the same queue and rejects the configuration. The prerender worker only renders static HTML and has no need for queue consumer registrations. This scenario was not considered when the prerender worker feature was introduced in PR #15711.
Fix
The prerenderWorker.config callback now destructures queues from entryWorkerConfig and only preserves queue producer bindings (dropping consumers):
I would also ask for an additional test fixture to be included (or maybe modified if appropriate) that covers this MRE scenario of a static build with a dynamic SSR endpoint that uses queues.
Activity
astrobot-houston commentedon Apr 2, 2026
I was able to reproduce this issue. The
@astrojs/cloudflareadapter'sprerenderWorker.configcallback spreads the entireentryWorkerConfig(includingqueues.consumers) into the prerender worker config. When Miniflare sees two workers (the entry worker and the prerender worker) both registered as consumers of the same queue, it rejects the configuration withERR_MULTIPLE_CONSUMERS. The prerender worker only renders static HTML and has no need for queue consumer registrations.I was able to fix this issue. The fix destructures
queuesfromentryWorkerConfigin the prerender worker config callback, droppingqueues.consumerswhile preservingqueues.producers(which are just bindings, not consumer registrations). This prevents Miniflare from seeing duplicate queue consumers. View Suggested FixP3: minor bug. This affects users who use Cloudflare Queues with
queues.consumersin theirwrangler.jsonand have a hybrid site (mix of prerendered and server-rendered pages) using the defaultworkerdprerender environment. This is a relatively specific combination of features, but it completely blocks builds for affected users with no workaround other than removing queue consumers from the config or switching toprerenderEnvironment: 'node'.Full Triage Report
Triage Report: Issue #16199
Original Issue
Title:
@astrojs/cloudflareprerender worker inheritsqueues.consumers, causing MiniflareERR_MULTIPLE_CONSUMERSerrorReporter: adamchal
Description: When a project uses Cloudflare Queues (with
queues.consumersinwrangler.json) and has a mix of prerendered and server-rendered pages,astro buildfails with:Environment:
Reproduction
Cloned MRE from https://github.com/adamchal/cloudflare-prerender-queue. The project has:
wrangler.jsonwithqueues.consumersandqueues.producersfor queuemy-queueindex.astro) and a server-rendered endpoint (api.tswithprerender = false)Steps:
queues.consumerstowrangler.jsonastro buildResult: Build fails with
Multiple consumers defined for queue "my-queue": "prerender" and "mre-prerender-queue"Root Cause
File:
packages/integrations/cloudflare/src/index.ts, lines 181-193The
prerenderWorker.configcallback spreads...entryWorkerConfigdirectly into the prerender worker config, which includesqueues.consumers. Miniflare then sees two workers both consuming the same queue and rejects the configuration. The prerender worker only renders static HTML and has no need for queue consumer registrations. This scenario was not considered when the prerender worker feature was introduced in PR #15711.Fix
The
prerenderWorker.configcallback now destructuresqueuesfromentryWorkerConfigand only preserves queue producer bindings (dropping consumers):config(_, { entryWorkerConfig }) { + const { queues, ...rest } = entryWorkerConfig; return { - ...entryWorkerConfig, + ...rest, name: 'prerender', + ...(queues?.producers?.length && { + queues: { producers: queues.producers }, + }), }; },Verification: Before fix,
ERR_MULTIPLE_CONSUMERSerror occurs. After fix, the error is resolved. All 17 existing wrangler tests pass.This report was made by an LLM. Mistakes happen, check important info.
matthewp commentedon Apr 3, 2026
@adamchal could you submit a PR for this?
corevibe555 commentedon Apr 3, 2026
@matthewp @adamchal If it's OK, I would love to contribute for this creating PR.
Would you assign me please?
Thank you!
adamchal commentedon Apr 3, 2026
@corevibe555 yes, please. I think the identified Fix should suffice:
config(_, { entryWorkerConfig }) { + const { queues, ...rest } = entryWorkerConfig; return { - ...entryWorkerConfig, + ...rest, name: 'prerender', + ...(queues?.producers?.length && { + queues: { producers: queues.producers }, + }), }; },I would also ask for an additional test fixture to be included (or maybe modified if appropriate) that covers this MRE scenario of a static build with a dynamic SSR endpoint that uses queues.
fix(cloudflare): exclude queue consumers from prerender worker (witha…
chore: merge main into next (#16434)