Skip to content

Commit 1c633ad

Browse files
authored
feat(onboarding): Add global sentry exception middlewares to tanstack 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.
1 parent 16b105a commit 1c633ad

File tree

1 file changed

+31
-1
lines changed
  • static/app/gettingStartedDocs/javascript-tanstackstart-react

1 file changed

+31
-1
lines changed

static/app/gettingStartedDocs/javascript-tanstackstart-react/onboarding.tsx

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,40 @@ export default defineConfig({
298298
{
299299
type: 'text',
300300
text: tct(
301-
'Sentry automatically captures unhandled client-side errors. On the server side of TanStack Start, automatic error monitoring is not yet supported. Use [code:captureException] to manually capture errors in your server-side code.',
301+
"To capture server-side errors from HTTP requests and server function invocations, add Sentry's global middlewares to [code:createStart()] in your [code:src/start.ts] file:",
302302
{code: <code />}
303303
),
304304
},
305+
{
306+
type: 'code',
307+
tabs: [
308+
{
309+
label: 'TypeScript',
310+
language: 'typescript',
311+
filename: 'src/start.ts',
312+
code: `import {
313+
sentryGlobalFunctionMiddleware,
314+
sentryGlobalRequestMiddleware,
315+
} from "@sentry/tanstackstart-react";
316+
import { createStart } from "@tanstack/react-start";
317+
318+
export const startInstance = createStart(() => {
319+
return {
320+
requestMiddleware: [sentryGlobalRequestMiddleware],
321+
functionMiddleware: [sentryGlobalFunctionMiddleware],
322+
};
323+
});`,
324+
},
325+
],
326+
},
327+
{
328+
type: 'alert',
329+
alertType: 'info',
330+
showIcon: false,
331+
text: t(
332+
'The Sentry middleware should be the first middleware in the arrays to ensure all errors are captured. SSR rendering exceptions are not captured by the middleware. Use captureException to manually capture those errors.'
333+
),
334+
},
305335
{
306336
type: 'text',
307337
text: tct(

0 commit comments

Comments
 (0)