Skip to content

Commit 878d338

Browse files
committed
fix(remix): Export no-op as captureRemixServerException from the client SDK.
1 parent 1b6c22e commit 878d338

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

packages/remix/src/index.client.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
import { applySdkMetadata, setTag } from '@sentry/core';
22
import { init as reactInit } from '@sentry/react';
3+
import { logger } from '@sentry/utils';
4+
import { DEBUG_BUILD } from './utils/debug-build';
35
import type { RemixOptions } from './utils/remixOptions';
46
export { captureRemixErrorBoundaryError } from './client/errors';
57
export { withSentry } from './client/performance';
68

79
export { browserTracingIntegration } from './client/browserTracingIntegration';
810

11+
// This is a no-op function that does nothing. It's here to make sure that the
12+
// function signature is the same as in the server SDK.
13+
// See issue: https://github.com/getsentry/sentry-javascript/issues/9594
14+
/* eslint-disable @typescript-eslint/no-unused-vars */
15+
export async function captureRemixServerException(
16+
err: unknown,
17+
name: string,
18+
request: Request,
19+
isRemixV2: boolean,
20+
): Promise<void> {
21+
DEBUG_BUILD &&
22+
logger.warn(
23+
'`captureRemixServerException` is a server-only function and should not be called in the browser. ' +
24+
'This function is a no-op in the browser environment.',
25+
);
26+
}
27+
/* eslint-enable @typescript-eslint/no-unused-vars */
28+
929
export * from '@sentry/react';
1030

1131
export function init(options: RemixOptions): void {

packages/remix/src/index.types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export declare const contextLinesIntegration: typeof clientSdk.contextLinesInteg
1818
export declare const getDefaultIntegrations: (options: Options) => Integration[];
1919
export declare const defaultStackParser: StackParser;
2020

21+
export declare function captureRemixServerException(
22+
err: unknown,
23+
name: string,
24+
request: Request,
25+
isRemixV2: boolean,
26+
): Promise<void>;
27+
2128
// This variable is not a runtime variable but just a type to tell typescript that the methods below can either come
2229
// from the client SDK or from the server SDK. TypeScript is smart enough to understand that these resolve to the same
2330
// methods from `@sentry/core`.

0 commit comments

Comments
 (0)