Skip to content

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

@adamchal

Description

@adamchal

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?

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 108
config(_, { entryWorkerConfig }) {
  return {
    ...entryWorkerConfig,   // <-- includes queues.consumers
    name: "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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)pkg: cloudflareRelated to the Cloudflare adapter

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions