Skip to content

Repository files navigation

[Bug]: @astrojs/cloudflare prerender worker inherits queues.consumers, causing Miniflare ERR_MULTIPLE_CONSUMERS error

Astro Info

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?

N/A (build-time error)

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},}),};},

Link to Minimal Reproducible Example

https://github.com/adamchal/cloudflare-prerender-queue

Participation

  • I am willing to submit a pull request for this issue.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages