You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Reviewed the existing TanStack Start React quick start guide and made
some updates:
- improved structures by adding subheadings
- rewrote some explanations to be more concise and in line with similar
content in other QS guides
- updated verification code snippets (tested with the latest version of
the framework)
Closes: #14878
## IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Rewrites and restructures the TanStack Start React quick start with
clearer client/server setup, SSR and server instrumentation, updated
tracing example, and improved verification and links.
>
> - **Docs — TanStack Start React guide (`index.mdx`)**:
> - **Restructure**: Clearer intro and step-based flow; added
subheadings and optional sections.
> - **Client/Server Setup**: Separate client and server init; clarified
config and options.
> - **Performance/SSR**: Added `wrapCreateRootRouteWithSentry` and
`wrapStreamHandlerWithSentry`; grouped under performance option.
> - **Server Functions**: Added global middleware via
`sentryGlobalServerMiddlewareHandler`.
> - **Error Handling**: Guidance for error boundaries via
`withErrorBoundary` and capturing `errorComponent` errors with
`captureException`; note on automatic client capture.
> - **Tracing Example**: Replaced API route with server route
`src/routes/sentry-example.ts` (`/sentry-example`); updated fetch path
and example code.
> - **Verification/Extras**: Added tunneling section; refined
verification steps; expanded Next Steps with product features and
troubleshooting links.
> - **Docs — Config (`config.yml`)**: Updated description to a more
comprehensive summary.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2ba052c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/tanstackstart-react/config.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
title: TanStack Start React
2
-
description: Learn how to set up TanStack Start React with Sentry.
2
+
description: Learn how to set up and configure Sentry in your TanStack Start React application, capturing your first errors, and viewing them in Sentry.
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/tanstackstart-react/index.mdx
+54-28Lines changed: 54 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,17 @@
1
1
---
2
2
title: TanStack Start React
3
-
description: "Learn how to set up and configure Sentry in your TanStack Start React application, capturing your first errors, and viewing them in Sentry."
4
3
---
5
4
6
5
<Alert>
7
6
8
7
This SDK is currently in **ALPHA**. Alpha features are still in progress, may have bugs and might include breaking changes.
9
8
Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns.
10
-
This SDK is for [TanStack Start (React)](https://tanstack.com/start/latest/docs/framework/react/overview), for
11
-
using [TanStack Router (React)](https://tanstack.com/router/latest/docs/framework/react/overview) see our React docs for
This guide walks you through setting up Sentry in a [TanStack Start (React)](https://tanstack.com/start/latest/docs/framework/react/overview) app.
13
+
For [TanStack Router (React)](https://tanstack.com/router/latest/docs/framework/react/overview), see our [React TanStack Router guide](/platforms/javascript/guides/react/features/tanstack-router).
Add the `sentryGlobalServerMiddlewareHandler` to your global middlewares to instrument your server function invocations:
181
+
### Instrument Server Functions
182
+
183
+
Add the Sentry middleware handler to your global middlewares in `src/global-middleware.ts` to instrument your server function invocations:
167
184
168
185
<Alertlevel="info">
169
186
170
-
If you haven't done so, create a `src/global-middleware.ts` file as outlined in the [TanStack Start Docs for Global Middleware](https://tanstack.com/start/latest/docs/framework/react/middleware#global-middleware).
187
+
If you haven't created `src/global-middleware.ts` file, follow the [TanStack Start documentation for Global Middleware](https://tanstack.com/start/latest/docs/framework/react/middleware#global-middleware) to set it up.
171
188
172
189
</Alert>
173
190
@@ -187,17 +204,19 @@ registerGlobalMiddleware({
187
204
});
188
205
```
189
206
190
-
### Capture Errors in your Error Boundaries and Components
207
+
### Capturing Errors in Error Boundaries and Components (Optional)
191
208
192
209
<Alertlevel="info">
193
-
Automatic error monitoring is not yet supported on the on the server-side of
194
-
TanStack Start. Use `captureException` to manually capture errors in your
195
-
server-side code.
210
+
Automatic error monitoring is not yet supported on the serverside of TanStack
211
+
Start. Use `captureException` to manually capture errors in your server-side
212
+
code.
196
213
</Alert>
197
214
198
-
The Sentry SDK cannot capture errors that you manually caught yourself with error boundaries.
215
+
Sentry automatically captures unhandled client-side errors. Errors caught by your own error boundaries aren't captured unless you report them manually:
199
216
200
-
If you have React error boundaries in your app and you want to report errors that these boundaries catch to Sentry, apply the [`withErrorBoundary` wrapper](/platforms/javascript/guides/react/features/error-boundary/) to your `ErrorBoundary`:
217
+
#### Custom Error Boundary
218
+
219
+
Wrap your custom `ErrorBoundary` component with [`withErrorBoundary`](/platforms/javascript/guides/react/features/error-boundary/):
If you defined `errorComponent`s in your Code-Based TanStack Router routes, capture the `error` argument with `captureException` inside a `useEffect` hook:
237
+
#### TanStack Router `errorComponent`
238
+
239
+
Use Sentry's `captureException` function inside a `useEffect` hook within your `errorComponent`:
Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.
240
265
241
266
### Issues
242
267
243
-
To verify that Sentry captures errors and creates issues in your Sentry project, add a test button to an existing page or create a new one:
268
+
To verify that Sentry captures errors and creates issues in your Sentry project, add a test button to one of your pages, which will trigger an error that Sentry will capture when you click it:
244
269
245
270
```tsx
246
271
<button
@@ -262,16 +287,15 @@ To verify that Sentry captures errors and creates issues in your Sentry project,
262
287
<OnboardingOptionoptionId="performance">
263
288
### Tracing
264
289
265
-
To test tracing, create a test API route like `/api/sentry-example-api`:
290
+
To test tracing, create a new file like `src/routes/sentry-example.ts` to create a test route `/sentry-example`:
0 commit comments