Skip to content

feat(astro): Serve the managed tunnel from the Sentry middleware - #25419

Open
logaretm wants to merge 8 commits into
awad/tunnel-nitrofrom
awad/tunnel-astro
Open

logaretm wants to merge 8 commits into
awad/tunnel-nitrofrom
awad/tunnel-astro

Conversation

@logaretm

@logaretm logaretm commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

This PR adds the tunnel wiring to the astro SDK. We already had a global middleware active, so it works by adding logic to check if the incoming request is a tunnel request and if it is, then it will be handled.

This also respects the decision made earlier to follow the base path configured by the user.

closes #25463

@logaretm
logaretm added this pull request to stack #25201 October 15, 2026 16:04
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 30.53 kB +2.18% +649 B 🔺
@sentry/browser - with treeshaking flags 28.51 kB +1.75% +490 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 28.39 kB +1.7% +473 B 🔺
@sentry/browser (incl. Tracing) 52.77 kB +1.35% +699 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 52.77 kB +1.35% +698 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.74 kB +1.32% +721 B 🔺
@sentry/browser (incl. Tracing, Replay) 92.44 kB +0.68% +616 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.18 kB +0.62% +496 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 97.18 kB +0.66% +629 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 110.17 kB +0.63% +683 B 🔺
@sentry/browser (incl. Feedback) 48.09 kB +1.48% +699 B 🔺
@sentry/browser (incl. sendFeedback) 35.6 kB +1.9% +662 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.73 kB +1.71% +683 B 🔺
@sentry/browser (incl. Metrics) 31.54 kB +2.05% +633 B 🔺
@sentry/browser (incl. Logs) 31.81 kB +2.01% +626 B 🔺
@sentry/browser (incl. Metrics & Logs) 32.48 kB +2.11% +670 B 🔺
@sentry/react 32.33 kB +2% +631 B 🔺
@sentry/react (incl. Tracing) 55.02 kB +1.17% +633 B 🔺
@sentry/vue 38.68 kB +1.7% +643 B 🔺
@sentry/vue (incl. Tracing) 55.72 kB +1.31% +716 B 🔺
@sentry/svelte 30.56 kB +2.2% +657 B 🔺
@sentry/remix (Remix 3 client bundle) 57.8 kB +1.26% +715 B 🔺
CDN Bundle 32.11 kB +1.49% +470 B 🔺
CDN Bundle (incl. Tracing) 53.06 kB +0.91% +478 B 🔺
CDN Bundle (incl. Logs, Metrics) 34.31 kB +1.41% +474 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 55.01 kB +0.89% +483 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 75.26 kB +0.66% +492 B 🔺
CDN Bundle (incl. Tracing, Replay) 90.73 kB +0.53% +478 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.66 kB +0.52% +479 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.87 kB +0.49% +468 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.83 kB +0.5% +489 B 🔺
CDN Bundle - uncompressed 94.33 kB +1.24% +1.15 kB 🔺
CDN Bundle (incl. Tracing) - uncompressed 157.19 kB +0.74% +1.15 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.87 kB +1.16% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.14 kB +0.72% +1.15 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 230.91 kB +0.51% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.35 kB +0.42% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.3 kB +0.41% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 291.06 kB +0.4% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 296.99 kB +0.39% +1.15 kB 🔺
@sentry/nextjs (client) 57.45 kB +1.08% +613 B 🔺
@sentry/sveltekit (client) 53.26 kB +1.54% +806 B 🔺
@sentry/core/server 42.85 kB +4.18% +1.72 kB 🔺
@sentry/core/browser 13.81 kB - -
@sentry/node 155.81 kB +0.47% +719 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 84.06 kB - -
@sentry/node - without tracing 97.48 kB +0.73% +701 B 🔺
@sentry/node - without channel injection 133.81 kB +0.53% +693 B 🔺
@sentry/aws-serverless 105.75 kB +0.78% +816 B 🔺
@sentry/cloudflare (withSentry) - minified 212.9 kB +0.96% +2.01 kB 🔺
@sentry/cloudflare (withSentry) 528.07 kB +0.94% +4.9 kB 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 230.58 kB +0.89% +2.01 kB 🔺

View base workflow run

@logaretm
logaretm force-pushed the awad/tunnel-astro branch 2 times, most recently from 3dfbedc to e9cafef Compare October 15, 2026 16:38
@logaretm

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/astro/src/server/middleware.ts
@logaretm

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@logaretm
logaretm force-pushed the awad/tunnel-astro branch 2 times, most recently from 3c79c4e to cd1c651 Compare October 16, 2026 14:00
@logaretm
logaretm marked this pull request as ready for review October 19, 2026 19:36
@logaretm
logaretm requested a review from a team as a code owner October 19, 2026 19:37
@logaretm
logaretm requested review from chargome and s1gr1d and removed request for a team October 19, 2026 19:37

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread dev-packages/e2e-tests/test-applications/astro-7/tests/tunnel.test.ts Outdated
Comment thread dev-packages/e2e-tests/test-applications/astro-7/tests/tunnel.test.ts Outdated
The Sentry middleware runs first and answers tunnel requests. The integration
hands Astro's `base` and `trailingSlash: 'always'` to both SDKs, so `tunnel: true`
follows Astro's routing without repeating them.
This reverts commit 6647a68. The middleware module ran the inline default init a second time, and running the init before a cold non-page request is a gap develop has for every server request, not one the tunnel adds.
The server's tunnel base path only reached `@sentry/astro`'s own server init. On Workers the client comes from
`@sentry/cloudflare`, so the browser posted under `base` and got a 404. The server side of the tunnel options
module now goes through core's managed tunnel defaults, and the Worker entry imports it first.
…the tunnel variant, and drop tests that repeat core's
@logaretm
logaretm requested review from a team as code owners October 19, 2026 20:08
@logaretm
logaretm requested review from JPeer264 and isaacs and removed request for a team October 19, 2026 20:08

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ba30e6a. Configure here.

span =>
getSpanOp(span) === 'http.server' &&
/\/docs\/[a-z0-9]{1,7}\/?$/.test(
String(span.attributes['url.path']?.value ?? span.attributes['url.full']?.value ?? span.name),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test uses hardcoded span attributes

Low Severity

This was flagged because the PR review rules require test assertions on span ops and attributes to use @sentry/conventions constants. The new tunnel E2E test compares getSpanOp to 'http.server' and reads 'url.path' / 'url.full' as string literals instead of HTTP_SERVER, URL_PATH, and URL_FULL.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit ba30e6a. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Astro managed tunnel

1 participant