-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathindex.ts
23 lines (21 loc) · 887 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* A middleware handler that can be passed to TanStack Start's `createMiddleware().server(...)` method as [global middleware](https://tanstack.com/start/latest/docs/framework/react/middleware#global-middleware) for instrumenting server functions.
*/
export function sentryGlobalServerMiddlewareHandler() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return function <T>(server: { next: (...args: any[]) => T }): T {
return server.next();
};
}
/**
* Wraps a TanStack Start stream handler with Sentry instrumentation that can be passed to `createStartHandler(...)`.
*/
export function wrapStreamHandlerWithSentry<H>(handler: H): H {
return handler;
}
/**
* Wraps the create root route function with Sentry for server-client tracing with SSR.
*/
export function wrapCreateRootRouteWithSentry<F>(createRootRoute: F): F {
return createRootRoute;
}