Title: TRPC Middleware Context not Working as Expected with Batch Requests · Issue #16262 · getsentry/sentry-javascript · GitHub
Open Graph Title: TRPC Middleware Context not Working as Expected with Batch Requests · Issue #16262 · getsentry/sentry-javascript
X Title: TRPC Middleware Context not Working as Expected with Batch Requests · Issue #16262 · 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/16262
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TRPC Middleware Context not Working as Expected with Batch Requests","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/nextjs\n\n### SDK Version\n\n9.17.0\n\n### Framework Version\n\nReact Next 15.3.1\n\n### Link to Sentry event\n\nhttps://amir-lf.sentry.io/issues/41286609/?project=4509151724830800&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=0\n\n### Reproduction Example/SDK Setup\n\nCreate a repo with minimal code that reproduces this https://github.com/17Amir17/SentryBug\nRepo contains a simple nextjs app with trpc and sentry\n\nOne route called `getCats` this route accepts two params one which when true throws an exception and the the other contains an id which gets added as a tag - https://github.com/17Amir17/SentryBug/blob/main/src/pages/api/trpc/%5Btrpc%5D.ts\n\n### Steps to Reproduce\n\nThere are two problem that I see, to reproduce the first\n\n2. Click \"throw error\" button\n3. Two calls to the same trpc route will be called in batch with different parameters\n4. A tag is added with the cat id\n5. And error is thrown\n6. 1 sentry event is created \n7. Tag does not match the context \n\nTo reproduce the second\n1. Click fetch button\n3. Two calls to the same trpc route will be called in batch with different parameters\n4. A tag is added with the cat id\n5. 2 sentry events are created\n6. Tag does not match context\n\n\n\n### Expected Result\n\nFor both issues I'd expect to see two events and for the context to match the tag\n\n\n### Actual Result\n\nFor the first issue the tags do not match the context and there is only 1 event created\n\nFor the second issue the there are two events but the tag does not match the context\n\n\n\n","author":{"url":"https://github.com/17Amir17","@type":"Person","name":"17Amir17"},"datePublished":"2025-05-12T12:31:32Z","url":"https://github.com/getsentry/sentry-javascript/issues/16262"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:118287f1-f398-d221-1058-ec88664545c7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2B4:26C2D4:827FF:AF9E1:6B0736BB |
| html-safe-nonce | 275fcc68cd78184cb58b91133003ff3614a43edfd7bbcb7182cf3462f82d0f78 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkI0OjI2QzJENDo4MjdGRjpBRjlFMTo2QjA3MzZCQiIsInZpc2l0b3JfaWQiOiI3NjcyNzk1NTEwODYwMTAxMzA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | eba38cf7b4e8b00031769d2a68235d8340e2a234d0ad021bf75faeb71f64a14f |
| hovercard-subject-tag | issue:3056809079 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/16262/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9960dfb8c6c61d08c3e0e2cf20f69761739806b4b855818754cedcfbdd20522a/getsentry/sentry-javascript/issues/16262 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9960dfb8c6c61d08c3e0e2cf20f69761739806b4b855818754cedcfbdd20522a/getsentry/sentry-javascript/issues/16262 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 17Amir17 |
| hostname | github.com |
| expected-hostname | github.com |
| None | d97a1befc96fc1512839eca15eb541061d491301144c9168e2985a8580319a49 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d28643426bfe8d1692f8788961b8217e9003f493 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width