Skip to content

@astrojs/cloudflare workerd prerender + @sentry/astro logs "addEventListener(): useCapture must be false" and writes empty prerendered HTML #15923

@martinsilha

Description

@martinsilha

Astro Info

Astro                    v6.0.4
Vite                     v7.3.1
Node                     v22.19.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/cloudflare (v13.1.1)
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Using Astro static output with the Cloudflare adapter and Sentry enabled at build time causes Cloudflare's default workerd prerender environment to throw:

TypeError: addEventListener(): useCapture must be false

during prerendering static routes.

Minimal repro setup:

Observed behavior in repro:

  1. SENTRY_AUTH_TOKEN=fake-token pnpm run build
  2. Build logs the useCapture must be false stack during prerender
  3. Build still finishes as complete
  4. dist/client/index.html is empty (0 bytes), indicating broken prerender output

Error stack in repro points into generated .prerender chunk with calls like:

  • whenReady
  • onTTFB
  • instrumentTtfb
  • startTrackingWebVitals

What's the expected result?

Cloudflare Workers build should either:

  • prerender correctly without runtime errors, producing non-empty HTML, or
  • fail hard with a non-zero exit code instead of silently producing empty prerender output.

Link to Minimal Reproducible Example

https://github.com/martinsilha/astro-cloudflare-sentry-prerender-bug

Participation

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

Metadata

Metadata

Assignees

No one assigned

    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