René's URL Explorer Experiment


Title: [Remix]: Sentry server instrumentation breaks loadContext parameter to handleRequest · Issue #8265 · getsentry/sentry-javascript · GitHub

Open Graph Title: [Remix]: Sentry server instrumentation breaks loadContext parameter to handleRequest · Issue #8265 · getsentry/sentry-javascript

X Title: [Remix]: Sentry server instrumentation breaks loadContext parameter to handleRequest · Issue #8265 · getsentry/sentry-javascript

Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...

Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...

X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...

Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/8265

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Remix]: Sentry server instrumentation breaks loadContext parameter to handleRequest","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/remix\n\n### SDK Version\n\n^7.53.1\n\n### Framework Version\n\nRemix 1.16.1\n\n### Link to Sentry event\n\nhttps://support-budget.sentry.io/issues/4217820559/?project=4505236358037504&referrer=project-issue-stream\n\n### SDK Setup\n\nServer-side (these break the application):\r\n```ts\r\nSentry.init({\r\n\tdsn: ENV.SENTRY_DSN,\r\n\t// Set tracesSampleRate to 1.0 to capture 100%\r\n\t// of transactions for performance monitoring.\r\n\t// We recommend adjusting this value in production\r\n\ttracesSampleRate: 1.0,\r\n})\r\n```\r\n(Also reproduced with the Prisma integration on the server, but the issue occurs regardless of any integrations provided).\r\n\r\nClient-side (though testing has shown that the site runs ok with _only_ the client-side integration present, so client options are only included for completeness - they do not affect the bug):\r\n```ts\r\nSentry.init({\r\n\tdsn: ENV.SENTRY_DSN,\r\n\tintegrations: [\r\n\t\tnew Sentry.BrowserTracing({\r\n\t\t\t// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled\r\n\t\t\ttracePropagationTargets: ['localhost'],\r\n\t\t\troutingInstrumentation: Sentry.remixRouterInstrumentation(\r\n\t\t\t\tuseEffect,\r\n\t\t\t\tuseLocation,\r\n\t\t\t\tuseMatches,\r\n\t\t\t),\r\n\t\t}),\r\n\t\t// Replay is only available in the client\r\n\t\tnew Sentry.Replay(),\r\n\t],\r\n\r\n\t// Set tracesSampleRate to 1.0 to capture 100%\r\n\t// of transactions for performance monitoring.\r\n\t// We recommend adjusting this value in production\r\n\ttracesSampleRate: 1.0,\r\n\r\n\t// Capture Replay for 10% of all sessions,\r\n\t// plus for 100% of sessions with an error\r\n\treplaysSessionSampleRate: 0.1,\r\n\treplaysOnErrorSampleRate: 1.0,\r\n})\r\n```\r\n\r\nI have created a sample repository with a reproduction of the problem, starting from Kent C Dodd's Epic Web Stack.\r\n\r\nRepository: https://github.com/dawnmist/sentry-remix-load-context-undefined.git\r\n\r\nBranches:\r\n- `main`: freshly created remix stack using `npx create-remix@latest --typescript --install --template epicweb-dev/epic-stack`\r\n- `sentry-remix-load-context-undefined`: added sentry instrumentation as per the document at: https://docs.sentry.io/platforms/javascript/guides/remix/\r\n- https://github.com/dawnmist/sentry-remix-load-context-undefined/pull/1/files - Draft PR showing the differences between those two branches.\r\n\r\nNote: the linked Sentry error is from my actual application when I was trying to trace what was going wrong, as I had tried to implement the nonce handling from the Epic Stack into my existing application then found that it completely broke. It took several hours and completely replacing my entry.server.ts file with a fresh one from that stack, then slowly adding changes back one at a time, to track the issue down to being due to the Sentry instrumentation. Once I had that, I then did a test using a fresh initialisation of the stack with only the sentry changes added to establish that it really was the addition of the sentry instrumentation that was causing the issue and to create a reproducible example I could provide for this report.\n\n### Steps to Reproduce\n\nWorking project prior to Sentry instrumentation:\r\n- Check out the main branch of the repository\r\n- Copy the `.env.example` file to `.env`\r\n- Run `npm run install`\r\n- Run `npm run dev` - you should get output like:\r\n```shell\r\n🔶 Mock server installed\r\n⚠️  Port 3000 is not available, using 3008 instead.\r\n🚀  We have liftoff!\r\nLocal:            http://localhost:3008\r\nOn Your Network:  http://192.168.1.20:3008\r\nPress Ctrl+C to stop\r\nApp server took 1.5s\r\n```\r\n- Load the url specified in the console log in a browser window\r\n==> you should see the \"EPIC STACK\" landing page.\r\n\r\nTo reproduce the Sentry problem:\r\n* Stop running the server\r\n* Check out the branch `sentry-remix-load-context-undefined`\r\n* Copy the `.env.example` file to `.env`, and update the (new to the branch) SENTRY_DSN variable to something you can use\r\n* Run `npm run install` to pick up the sentry libraries\r\n* Run `npm run dev` - you should get the same output as before\r\n* Load the url specified in the console log in a browser window\r\n==> The page throws the error:\r\n```\r\nUnexpected Server Error\r\n\r\nTypeError: Cannot read properties of undefined (reading 'cspNonce')\r\n```\r\n\r\nTesting variations locally has shown that if either of the modifications to `./app/entry.server.ts` (Sentry.init on the remix server) or `./server/index.ts` (using wrapExpressCreateRequestHandler) are present the remix server will not receive the value created for the `loadContext` parameter to the `handleRequest` function in `./app/entry.server.ts` file. The client side Sentry.init does not affect the issue at all.\n\n### Expected Result\n\nThe function `handleRequest` in `./app/entry.server.ts` should be properly receiving the context information that is being set in the express server in `./server/index.ts` regardless of whether Sentry instrumentation has been applied to the server.\n\n### Actual Result\n\nIf the server has either or both of the `Sentry.init` on the `./app/entry.server.ts` file OR `wrapExpressCreateRequestHandler` used in an express server that runs the remix server, the context being set with the `getLoadContext` option to the `createRequestHandler` function is not passed through to the remix application in the `handleRequest` function's `loadContext` parameter.","author":{"url":"https://github.com/dawnmist","@type":"Person","name":"dawnmist"},"datePublished":"2023-05-31T14:34:46Z","url":"https://github.com/getsentry/sentry-javascript/issues/8265"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3e48464e-11cf-541f-a8de-0c55573804db
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC300:1C5C1D:23AB93C:2FCA3B0:6B044C1B
html-safe-nonce399b8d4ed1b0982b1eeda66f256954927c10977c58ef7cf8df1d06408315415e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzAwOjFDNUMxRDoyM0FCOTNDOjJGQ0EzQjA6NkIwNDRDMUIiLCJ2aXNpdG9yX2lkIjoiMTkxMjkyNzYwODc5MDg2Mjg3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac26336ae2f05d9c109e2c68fb1e6ef873f27a46430b1e408d78e25b5674138519
hovercard-subject-tagissue:1734378178
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/8265/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0b79f4f3121cd280e8c651c9095c460fde460aea1d73bb129d590e972638285e/getsentry/sentry-javascript/issues/8265
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0b79f4f3121cd280e8c651c9095c460fde460aea1d73bb129d590e972638285e/getsentry/sentry-javascript/issues/8265
og:image:altIs there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedawnmist
hostnamegithub.com
expected-hostnamegithub.com
None002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release059f24c781e3a0d7df3f27a97da0e93fab06ae39
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/8265#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F8265
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%2Fissues%2F8265
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/issues/8265
Reloadhttps://github.com/getsentry/sentry-javascript/issues/8265
Reloadhttps://github.com/getsentry/sentry-javascript/issues/8265
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues339 (339)https://github.com/getsentry/sentry-javascript/issues
Pull requests54 (54)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
https://github.com/getsentry/sentry-javascript
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/8265
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/8265
[Remix]: Sentry server instrumentation breaks loadContext parameter to handleRequesthttps://github.com/getsentry/sentry-javascript/issues/8265#top
https://github.com/onurtemizkan
https://github.com/dawnmist
dawnmisthttps://github.com/dawnmist
on May 31, 2023https://github.com/getsentry/sentry-javascript/issues/8265#issue-1734378178
https://github.com/getsentry/sentry-javascript/issueshttps://github.com/getsentry/sentry-javascript/issues
https://docs.sentry.io/https://docs.sentry.io/
https://github.com/getsentry/sentry-javascript/releaseshttps://github.com/getsentry/sentry-javascript/releases
https://support-budget.sentry.io/issues/4217820559/?project=4505236358037504&referrer=project-issue-streamhttps://support-budget.sentry.io/issues/4217820559/?project=4505236358037504&referrer=project-issue-stream
https://github.com/dawnmist/sentry-remix-load-context-undefined.githttps://github.com/dawnmist/sentry-remix-load-context-undefined.git
https://docs.sentry.io/platforms/javascript/guides/remix/https://docs.sentry.io/platforms/javascript/guides/remix/
https://github.com/dawnmist/sentry-remix-load-context-undefined/pull/1/fileshttps://github.com/dawnmist/sentry-remix-load-context-undefined/pull/1/files
dawnmisthttps://github.com/dawnmist
Type: Bughttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Type%3A%20Bug%22
on May 31, 2023https://github.com/getsentry/sentry-javascript/issues/8265#event-9391429028
getsantryhttps://github.com/apps/getsantry
Status: Untriagedhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Untriaged%22
on May 31, 2023https://github.com/getsentry/sentry-javascript/issues/8265#event-9391429530
https://github.com/scefali
scefalihttps://github.com/scefali
on May 31, 2023https://github.com/getsentry/sentry-javascript/issues/8265#issuecomment-1570651114
https://github.com/scefali/epic-stack/tree/scefali/sentryhttps://github.com/scefali/epic-stack/tree/scefali/sentry
dawnmisthttps://github.com/dawnmist
on Jun 1, 2023https://github.com/getsentry/sentry-javascript/issues/8265#event-9401357935
Pass loadContext through wrapped document request functionhttps://github.com/dawnmist/sentry-javascript/commit/77db35bf981b628f37c3897ae03c6c999465a2a6
77db35bhttps://github.com/dawnmist/sentry-javascript/commit/77db35bf981b628f37c3897ae03c6c999465a2a6
Pass loadContext through wrapped document request functionhttps://github.com/dawnmist/sentry-javascript/commit/b9943b868c38e32bae40077b92fba379986290d8
b9943b8https://github.com/dawnmist/sentry-javascript/commit/b9943b868c38e32bae40077b92fba379986290d8
https://github.com/Lms24
Lms24https://github.com/Lms24
on Jun 1, 2023https://github.com/getsentry/sentry-javascript/issues/8265#issuecomment-1571832738
@dawnmisthttps://github.com/dawnmist
@onurtemizkanhttps://github.com/onurtemizkan
Lms24https://github.com/Lms24
Status: Backloghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Backlog%22
Status: Untriagedhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Untriaged%22
on Jun 1, 2023https://github.com/getsentry/sentry-javascript/issues/8265#event-9401751975
Lms24https://github.com/Lms24
Lms24https://github.com/Lms24
onurtemizkanhttps://github.com/onurtemizkan
Lms24https://github.com/Lms24
on Jun 1, 2023https://github.com/getsentry/sentry-javascript/issues/8265#event-9401752657
Lms24https://github.com/Lms24
on Jun 1, 2023https://github.com/getsentry/sentry-javascript/issues/8265#event-9402468441
fix(remix): Pass `loadContext` through wrapped document request funct…https://github.com/getsentry/sentry-javascript/commit/c368bc8b79203804ae27094c22a6c5ae5da3afce
c368bc8https://github.com/getsentry/sentry-javascript/commit/c368bc8b79203804ae27094c22a6c5ae5da3afce
https://github.com/Lms24
Lms24https://github.com/Lms24
on Jun 1, 2023https://github.com/getsentry/sentry-javascript/issues/8265#issuecomment-1571931152
#8268https://github.com/getsentry/sentry-javascript/pull/8268
Lms24https://github.com/Lms24
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 1, 2023https://github.com/getsentry/sentry-javascript/issues/8265#event-9402471608
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/8265
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/8265
onurtemizkanhttps://github.com/onurtemizkan
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-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.