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
## DESCRIBE YOUR PR
This PR changes the TanStack Start docs to be compatible with the
current 1.0 RC version.
## 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/)
---------
Co-authored-by: Sarah Mischinger <[email protected]>
This SDK is currently in **ALPHA**. Alpha features are still in progress, may have bugs and might include breaking changes.
7
+
This SDK is compatible with TanStack Start 1.0 RC and is currently in **ALPHA**. Alpha features are still in progress, may have bugs and might include breaking changes.
8
8
Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns.
+ // Additional SDK configuration goes in here, for example:
81
+
+ colorScheme: "system",
82
+
+ }),
83
+
+// ___PRODUCT_OPTION_END___ user-feedback
84
+
+ ],
85
+
+ // ___PRODUCT_OPTION_START___ logs
86
+
+
87
+
+ // Enable logs to be sent to Sentry
88
+
+ enableLogs: true,
89
+
+ // ___PRODUCT_OPTION_END___ logs
90
+
+
91
+
+ // ___PRODUCT_OPTION_START___ performance
92
+
+ // Set tracesSampleRate to 1.0 to capture 100%
93
+
+ // of transactions for tracing.
94
+
+ // We recommend adjusting this value in production.
95
+
+ // Learn more at https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
96
+
+ tracesSampleRate: 1.0,
97
+
+ // ___PRODUCT_OPTION_END___ performance
98
+
+ // ___PRODUCT_OPTION_START___ session-replay
99
+
+
100
+
+ // Capture Replay for 10% of all sessions,
101
+
+ // plus for 100% of sessions with an error.
102
+
+ // Learn more at https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration
103
+
+ replaysSessionSampleRate: 0.1,
104
+
+ replaysOnErrorSampleRate: 1.0,
105
+
+ // ___PRODUCT_OPTION_END___ session-replay
106
+
+ });
107
+
}
108
+
}
109
109
```
110
110
111
-
### Configure Server-Side Sentry
111
+
### Configure Server-side Sentry
112
112
113
-
Next, import and initialize Sentry in `src/server.tsx`:
113
+
Create an instrument file `instrument.server.mjs` in the root of your project. In this file, initialize the Sentry SDK for your server:
114
114
115
-
```tsx {filename:src/server.tsx}
115
+
```tsx {filename:instrument.server.mjs}
116
116
import*asSentryfrom"@sentry/tanstackstart-react";
117
117
118
118
Sentry.init({
@@ -138,80 +138,49 @@ Sentry.init({
138
138
});
139
139
```
140
140
141
-
<OnboardingOptionoptionId="performance">
142
-
143
-
### Apply Tracing to SSR
141
+
#### Moving the Sentry server config file for production usage
144
142
145
-
Wrap `createRootRoute`with `wrapCreateRootRouteWithSentry` in `src/routes/__root.tsx` to apply tracing to Server-Side Rendering (SSR):
143
+
For production monitoring, you need to move the Sentry server config file to your build output. Since [TanStack Start is designed to work with any hosting provider](https://tanstack.com/start/latest/docs/framework/react/guide/hosting), the exact location will depend on where your build artifacts are deployed (for example, `"/dist"`, `".output/server"` or a platform-specific directory).
Add the Sentry middleware handler to your global middlewares in `src/global-middleware.ts` to instrument your server function invocations:
184
-
185
-
<Alertlevel="info">
186
-
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.
188
-
189
-
</Alert>
190
-
191
-
```ts {filename:src/global-middleware.ts}
192
-
import {
193
-
createMiddleware,
194
-
registerGlobalMiddleware,
195
-
} from"@tanstack/react-start";
196
-
import*asSentryfrom"@sentry/tanstackstart-react";
197
-
198
-
registerGlobalMiddleware({
199
-
middleware: [
200
-
createMiddleware({ type: "function" }).server(
201
-
Sentry.sentryGlobalServerMiddlewareHandler()
202
-
),
203
-
],
204
-
});
205
-
```
172
+
## Step 3: Capture TanStack Start React Errors
206
173
207
-
### Capturing Errors in Error Boundaries and Components (Optional)
174
+
### Instrument Server Requests and Server Functions
208
175
209
176
<Alertlevel="info">
210
177
Automatic error monitoring is not yet supported on the server side of TanStack
211
178
Start. Use `captureException` to manually capture errors in your server-side
212
179
code.
213
180
</Alert>
214
181
182
+
### Capturing Errors in Error Boundaries and Components (Optional)
183
+
215
184
Sentry automatically captures unhandled client-side errors. Errors caught by your own error boundaries aren't captured unless you report them manually:
216
185
217
186
#### Custom Error Boundary
@@ -287,18 +256,26 @@ To verify that Sentry captures errors and creates issues in your Sentry project,
287
256
<OnboardingOptionoptionId="performance">
288
257
### Tracing
289
258
290
-
To test tracing, create a new file like `src/routes/sentry-example.ts` to create a test route `/sentry-example`:
259
+
To test tracing, create a new file like `src/routes/api/sentry-example.ts` to create a test route `/sentry-example`:
0 commit comments