feat(tanstackstart-react): Add global sentry exception middlewares#19330
Merged
nicohrubec merged 22 commits intodevelopfrom Feb 17, 2026
Merged
feat(tanstackstart-react): Add global sentry exception middlewares#19330nicohrubec merged 22 commits intodevelopfrom
nicohrubec merged 22 commits intodevelopfrom
Conversation
Contributor
Codecov Results 📊Generated by Codecov Action |
Contributor
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
nicohrubec
commented
Feb 16, 2026
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| '~types': any; | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| options: { server?: (...args: any[]) => any }; |
Member
Author
There was a problem hiding this comment.
typescript kept complaining in my sample app that the types of the new sentry middlewares clash with what is expected from tanstack (it was still running fine thought), had to change it to this to fix that
andreiborza
approved these changes
Feb 16, 2026
Member
andreiborza
left a comment
There was a problem hiding this comment.
LGTM overall! Nice workaround for the time being.
dev-packages/e2e-tests/test-applications/tanstackstart-react/tests/errors.test.ts
Show resolved
Hide resolved
andreiborza
approved these changes
Feb 17, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Contributor
size-limit report 📦
|
This was referenced Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
sentryGlobalRequestMiddlewareandsentryGlobalFunctionMiddlewarethat capture unhandled errors from all HTTP requests and server function invocations. Users add these as the first entries in therequestMiddleware/functionMiddlewarearrays ofcreateStart(). These internal middlewares get marked with a__SENTRY_INTERNAL__, so that they can be easily skipped in the vite plugin to exclude them from middleware auto-instrumentation. Originally we wanted to do this in the server-entry-point, but since there haven't been any updates on this front in months I propose this as an alternative solution for now. This is probably slightly worse UX but in my case better than having nothing in place.We could also think about auto-injecting this during the build, but maybe not worth the effort since this is a one-time setup step.
Limitations
Tanstack Start has three types of server-side errors that we care about. With these middlewares we can capture 2 of these (route, function exceptions). We cannot capture SSR exceptions like this, because the exceptions are serialized at a deeper layer and newer thrown.
Usage
Tests
Closes #18283