Uh oh!
There was an error while loading. Please reload this page.
feat(tanstackstart-react): Add global sentry exception middlewares - #19330
Conversation
Codecov Results 📊Generated by Codecov Action |
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.
|
| // 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 }; |
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
Uh oh!
There was an error while loading. Please reload this page.
andreiborza
left a comment
There was a problem hiding this comment.
LGTM overall! Nice workaround for the time being.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
size-limit report 📦
|
Uh oh!
There was an error while loading. Please reload this page.
…16411) We added global sentry middlewares to capture server-side errors in the Tanstack Start SDK. [PR](getsentry/sentry-javascript#19330) This will ship with the `10.40.0` release of the javascript SDKs. Updating the docs accordingly. --------- Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>
… start onboarding (#108351) We added global sentry middlewares to capture server-side errors in the Tanstack Start SDK. [PR](getsentry/sentry-javascript#19330) [Docs PR](getsentry/sentry-docs#16411) This will ship with the `10.40.0` release of the javascript SDKs. Updating the onboarding accordingly.
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