René's URL Explorer Experiment


Title: fix(astro): Ensure traces are correctly propagated for static routes by mydea · Pull Request #17536 · getsentry/sentry-javascript · GitHub

Open Graph Title: fix(astro): Ensure traces are correctly propagated for static routes by mydea · Pull Request #17536 · getsentry/sentry-javascript

X Title: fix(astro): Ensure traces are correctly propagated for static routes by mydea · Pull Request #17536 · getsentry/sentry-javascript

Description: This refactors the astro middleware a bit to be more correct & future proof. Right now, http.server spans are not emitted by the node http integration because import-in-the-middle does not work with Astro. So we emit our own. This PR makes astro ready to also handle the base http.server spans and enhance them with routing information. It also handles static routes better: these do not emit spans anymore now, and do not continue traces, but instead only propagate the parametrized route to the client, no trace data. One fundamental problem remains that is not fixed in this PR: Sentry.init() is only injected via page-ssr into SSR pages. This means that only once any SSR page is hit, the server-side part of Sentry is initialized. If you hit a prerendered (static) page first, sentry will not be initialized and thus neither errors are captured nor spans created. For regular prerendered pages this should be fine because we do not need to run anything at runtime there. However, when you hit a prerendered page that has a server-island, the server island (which is dynamic) will not be instrumented either because Sentry is not initialized yet. I don't think we can fix this with the current set of primitives we have, so this is a future problem to look into...

Open Graph Description: This refactors the astro middleware a bit to be more correct & future proof. Right now, http.server spans are not emitted by the node http integration because import-in-the-middle does not work...

X Description: This refactors the astro middleware a bit to be more correct & future proof. Right now, http.server spans are not emitted by the node http integration because import-in-the-middle does not ...

Opengraph URL: https://github.com/getsentry/sentry-javascript/pull/17536

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:652d5fe2-231b-6442-6e98-021dfb948b7c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBCD8:1B6A64:9F2FC1:D7B2D3:6B053EB0
html-safe-nonce6ecd601b6ed3c0e747cc8589147dfbf57c46859fa03b716ac2576741de122a78
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0Q4OjFCNkE2NDo5RjJGQzE6RDdCMkQzOjZCMDUzRUIwIiwidmlzaXRvcl9pZCI6IjI3OTY0Njk5NzU3NzM0Mjk0MjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac3af963af11b19260dbb6046ec4489cf38b36b1835ef2cb5d9cb3a1add56076c7
hovercard-subject-tagpull_request:2801997877
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/getsentry/sentry-javascript/pull/17536/files
twitter:imagehttps://avatars.githubusercontent.com/u/2411343?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/2411343?s=400&v=4
og:image:altThis refactors the astro middleware a bit to be more correct & future proof. Right now, http.server spans are not emitted by the node http integration because import-in-the-middle does not work...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release220e980097d94ce616d5d11fbd5316d208e3fc93
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/pull/17536/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fpull%2F17536%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fpull%2F17536%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/pull/17536/files
Reloadhttps://github.com/getsentry/sentry-javascript/pull/17536/files
Reloadhttps://github.com/getsentry/sentry-javascript/pull/17536/files
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues333 (333)https://github.com/getsentry/sentry-javascript/issues
Pull requests52 (52)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgetsentry%2Fsentry-javascript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgetsentry%2Fsentry-javascript%2Fissues%2Fnew%2Fchoose
mydeahttps://github.com/mydea
develophttps://github.com/getsentry/sentry-javascript/tree/develop
fn/astro-fixeshttps://github.com/getsentry/sentry-javascript/tree/fn/astro-fixes
Conversation 21 https://github.com/getsentry/sentry-javascript/pull/17536
Commits 7 https://github.com/getsentry/sentry-javascript/pull/17536/commits
Checks 0 https://github.com/getsentry/sentry-javascript/pull/17536/checks
Files changed https://github.com/getsentry/sentry-javascript/pull/17536/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/17536/files
fix(astro): Ensure traces are correctly propagated for static routes https://github.com/getsentry/sentry-javascript/pull/17536/files#top
Show all changes 7 commits https://github.com/getsentry/sentry-javascript/pull/17536/files
d7b27de fix(astro): Ensure traces are correctly propagated for static routes mydea Sep 5, 2025 https://github.com/getsentry/sentry-javascript/pull/17536/commits/d7b27de3229f13ce373e39c1e62679fe24eacc22
635f73f remove unneeded thing mydea Sep 5, 2025 https://github.com/getsentry/sentry-javascript/pull/17536/commits/635f73fb42c5c204103da063c4a931ff84d0df2b
247c50a fix case without parametrized route mydea Sep 5, 2025 https://github.com/getsentry/sentry-javascript/pull/17536/commits/247c50a1bc10885959d8ac384bb322ca086aeb03
eb9947b no need to check client again mydea Sep 5, 2025 https://github.com/getsentry/sentry-javascript/pull/17536/commits/eb9947b63f4318209887e4aec4ea1e50d76d8406
66aa46f Apply suggestion from @Lms24 mydea Sep 5, 2025 https://github.com/getsentry/sentry-javascript/pull/17536/commits/66aa46fa98f901199062d5f0b85d108913428bf3
72f1a79 set method better mydea Sep 5, 2025 https://github.com/getsentry/sentry-javascript/pull/17536/commits/72f1a793371899d806273da2f9cfc47eb3751cd7
ccb5060 test fixes mydea Sep 5, 2025 https://github.com/getsentry/sentry-javascript/pull/17536/commits/ccb50604b9706f09f5d64d7bf25cabed1d6afde7
Clear filters https://github.com/getsentry/sentry-javascript/pull/17536/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/17536/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/17536/files
package.json https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-cc2786c1003a21add5fe5c7d638e994e32646fbb144a68d84b66d4b679ea06c9
playwright.config.mjs https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-a69bb434d4af691c0d989a6857667ab76dc3da9172f3d8cbbc45707523c7fc18
errors.client.test.ts https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-5d38e3ee83d636d0762158bd6b5960a4643d78ad77c82e46776b1d5e3c11d853
tracing.static.test.ts https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-bee3de75981860f36c7c7c3dd1cf3b4334782113ebe042e2dc56b27d091aad0b
package.json https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-97e87fab5deef0c31ffcc8a2737896ae89c82b1311dce5df96223c6c1d00198e
playwright.config.mjs https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-e988eb7a1cc232d392627fb96a3bbab555d7ea2bbd04fba75b77eb6ad49bd1a5
errors.client.test.ts https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6549ec7bc2634c67a039e5e8f71ff4c109f7fea98afed7421c78bee9015382ce
tracing.serverIslands.test.ts https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6b9fca7d908128427fb8c13585025e43b0b472f0f088464b1461330f35897946
tracing.static.test.ts https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-44d684a04c83b676f0176ee069db7bfc55cd150fdd78198e6e367fcee4a4d7c9
middleware.ts https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-e94a9f9c56d1c44471cedff02057558410865a4dbd7982df900ac58297be649a
middleware.test.ts https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-14e0090d088b73c9e82651c3c299d48f2f34a3b5229754060bdb938cebe9cd6b
dev-packages/e2e-tests/test-applications/astro-4/package.jsonhttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-cc2786c1003a21add5fe5c7d638e994e32646fbb144a68d84b66d4b679ea06c9
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-4/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-cc2786c1003a21add5fe5c7d638e994e32646fbb144a68d84b66d4b679ea06c9
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-cc2786c1003a21add5fe5c7d638e994e32646fbb144a68d84b66d4b679ea06c9
dev-packages/e2e-tests/test-applications/astro-4/playwright.config.mjshttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-a69bb434d4af691c0d989a6857667ab76dc3da9172f3d8cbbc45707523c7fc18
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-4/playwright.config.mjs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-a69bb434d4af691c0d989a6857667ab76dc3da9172f3d8cbbc45707523c7fc18
dev-packages/e2e-tests/test-applications/astro-4/tests/errors.client.test.tshttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-5d38e3ee83d636d0762158bd6b5960a4643d78ad77c82e46776b1d5e3c11d853
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-4/tests/errors.client.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-5d38e3ee83d636d0762158bd6b5960a4643d78ad77c82e46776b1d5e3c11d853
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-5d38e3ee83d636d0762158bd6b5960a4643d78ad77c82e46776b1d5e3c11d853
dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.static.test.tshttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-bee3de75981860f36c7c7c3dd1cf3b4334782113ebe042e2dc56b27d091aad0b
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.static.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-bee3de75981860f36c7c7c3dd1cf3b4334782113ebe042e2dc56b27d091aad0b
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-bee3de75981860f36c7c7c3dd1cf3b4334782113ebe042e2dc56b27d091aad0b
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-bee3de75981860f36c7c7c3dd1cf3b4334782113ebe042e2dc56b27d091aad0b
dev-packages/e2e-tests/test-applications/astro-5/package.jsonhttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-97e87fab5deef0c31ffcc8a2737896ae89c82b1311dce5df96223c6c1d00198e
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-5/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-97e87fab5deef0c31ffcc8a2737896ae89c82b1311dce5df96223c6c1d00198e
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-97e87fab5deef0c31ffcc8a2737896ae89c82b1311dce5df96223c6c1d00198e
dev-packages/e2e-tests/test-applications/astro-5/playwright.config.mjshttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-e988eb7a1cc232d392627fb96a3bbab555d7ea2bbd04fba75b77eb6ad49bd1a5
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-5/playwright.config.mjs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-e988eb7a1cc232d392627fb96a3bbab555d7ea2bbd04fba75b77eb6ad49bd1a5
dev-packages/e2e-tests/test-applications/astro-5/tests/errors.client.test.tshttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6549ec7bc2634c67a039e5e8f71ff4c109f7fea98afed7421c78bee9015382ce
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-5/tests/errors.client.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6549ec7bc2634c67a039e5e8f71ff4c109f7fea98afed7421c78bee9015382ce
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6549ec7bc2634c67a039e5e8f71ff4c109f7fea98afed7421c78bee9015382ce
dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.serverIslands.test.tshttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6b9fca7d908128427fb8c13585025e43b0b472f0f088464b1461330f35897946
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.serverIslands.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6b9fca7d908128427fb8c13585025e43b0b472f0f088464b1461330f35897946
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6b9fca7d908128427fb8c13585025e43b0b472f0f088464b1461330f35897946
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6b9fca7d908128427fb8c13585025e43b0b472f0f088464b1461330f35897946
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-6b9fca7d908128427fb8c13585025e43b0b472f0f088464b1461330f35897946
dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.static.test.tshttps://github.com/getsentry/sentry-javascript/pull/17536/files#diff-44d684a04c83b676f0176ee069db7bfc55cd150fdd78198e6e367fcee4a4d7c9
View file https://github.com/getsentry/sentry-javascript/blob/ccb50604b9706f09f5d64d7bf25cabed1d6afde7/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.static.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/17536/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-44d684a04c83b676f0176ee069db7bfc55cd150fdd78198e6e367fcee4a4d7c9
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-44d684a04c83b676f0176ee069db7bfc55cd150fdd78198e6e367fcee4a4d7c9
https://github.com/getsentry/sentry-javascript/pull/17536/files#diff-44d684a04c83b676f0176ee069db7bfc55cd150fdd78198e6e367fcee4a4d7c9
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/17536/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.