Skip to content

Commit 5454b9d

Browse files
authored
docs(tanstackstart-react): Add wrapFetchWithSentry (#15861)
## DESCRIBE YOUR PR We will release a new `wrapFetchWithSentry` API for the Tanstack Start SDK that adds support for server-side tracing. Later this will also handle server-side error monitoring, but that doesn't work yet.
1 parent f3a97ee commit 5454b9d

File tree

1 file changed

+22
-0
lines changed
  • docs/platforms/javascript/guides/tanstackstart-react

1 file changed

+22
-0
lines changed

docs/platforms/javascript/guides/tanstackstart-react/index.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,28 @@ Sentry.init({
140140
});
141141
```
142142

143+
<OnboardingOption optionId="performance">
144+
#### Instrument the Server Entry Point
145+
146+
To enable tracing for server-side requests, you need to explicitly define a [server entry point](https://tanstack.com/start/latest/docs/framework/react/guide/server-entry-point) in your application and wrap your request handler with `wrapFetchWithSentry`.
147+
148+
Create a `src/server.ts` file in your project:
149+
150+
```typescript {filename:src/server.ts}
151+
import { wrapFetchWithSentry } from "@sentry/tanstackstart-react";
152+
import handler, { createServerEntry } from "@tanstack/react-start/server-entry";
153+
154+
export default createServerEntry(
155+
wrapFetchWithSentry({
156+
fetch(request: Request) {
157+
return handler.fetch(request);
158+
},
159+
})
160+
);
161+
```
162+
163+
</OnboardingOption>
164+
143165
#### Moving the Sentry server config file for production usage
144166

145167
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).

0 commit comments

Comments
 (0)