-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
@astrojs/cloudflare workerd prerender + @sentry/astro logs "addEventListener(): useCapture must be false" and writes empty prerendered HTML #15923
Copy link
Copy link
Open
Labels
Description
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:
astro@6.0.4@astrojs/cloudflare@13.1.1@sentry/astro@10.43.0@sentry/cloudflare@10.43.0SENTRY_AUTH_TOKENis set (any non-empty value)sentry.client.config.jsandsentry.server.config.jscallSentry.init(...)- Cloudflare adapter uses default prerender environment (
workerd)
Observed behavior in repro:
SENTRY_AUTH_TOKEN=fake-token pnpm run build- Build logs the
useCapture must be falsestack during prerender - Build still finishes as complete
dist/client/index.htmlis empty (0bytes), indicating broken prerender output
Error stack in repro points into generated .prerender chunk with calls like:
whenReadyonTTFBinstrumentTtfbstartTrackingWebVitals
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.
Reactions are currently unavailable