Skip to content

Commit ee3da8d

Browse files
committed
fix(tanstackstart-react): stub createSentryTunnelRoute on client
1 parent 5a2c6e9 commit ee3da8d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/tanstackstart-react/src/client/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703
33
/* eslint-disable import/export */
44
import type { TanStackMiddlewareBase } from '../common/types';
5+
import type { CreateSentryTunnelRouteOptions } from '../server/tunnelRoute';
56

67
export * from '@sentry/react';
78

@@ -26,3 +27,19 @@ export const sentryGlobalRequestMiddleware: TanStackMiddlewareBase = { '~types':
2627
* The actual implementation is server-only, but this stub is needed to prevent rendering errors.
2728
*/
2829
export const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase = { '~types': undefined, options: {} };
30+
31+
/**
32+
* No-op stub for client-side builds.
33+
* The actual implementation is server-only, but this stub is needed to prevent rendering errors.
34+
*/
35+
export function createSentryTunnelRoute(_options: CreateSentryTunnelRouteOptions): {
36+
handlers: {
37+
POST: () => Promise<Response>;
38+
};
39+
} {
40+
return {
41+
handlers: {
42+
POST: async () => new Response(null, { status: 500 }),
43+
},
44+
};
45+
}

packages/tanstackstart-react/src/index.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ export declare const wrapMiddlewaresWithSentry: typeof serverSdk.wrapMiddlewares
4242
export declare const tanstackRouterBrowserTracingIntegration: typeof clientSdk.tanstackRouterBrowserTracingIntegration;
4343
export declare const sentryGlobalRequestMiddleware: typeof serverSdk.sentryGlobalRequestMiddleware;
4444
export declare const sentryGlobalFunctionMiddleware: typeof serverSdk.sentryGlobalFunctionMiddleware;
45+
export declare const createSentryTunnelRoute: typeof serverSdk.createSentryTunnelRoute;

0 commit comments

Comments
 (0)