Skip to content

fix(remix): Export no-op as captureRemixServerException from client SDK #12497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/remix/src/index.client.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
import { applySdkMetadata, setTag } from '@sentry/core';
import { init as reactInit } from '@sentry/react';
import { logger } from '@sentry/utils';
import { DEBUG_BUILD } from './utils/debug-build';
import type { RemixOptions } from './utils/remixOptions';
export { captureRemixErrorBoundaryError } from './client/errors';
export { withSentry } from './client/performance';

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

// This is a no-op function that does nothing. It's here to make sure that the
// function signature is the same as in the server SDK.
// See issue: https://github.com/getsentry/sentry-javascript/issues/9594
/* eslint-disable @typescript-eslint/no-unused-vars */
export async function captureRemixServerException(
err: unknown,
name: string,
request: Request,
isRemixV2: boolean,
): Promise<void> {
DEBUG_BUILD &&
logger.warn(
'`captureRemixServerException` is a server-only function and should not be called in the browser. ' +
'This function is a no-op in the browser environment.',
);
}
/* eslint-enable @typescript-eslint/no-unused-vars */

export * from '@sentry/react';

export function init(options: RemixOptions): void {
Expand Down
7 changes: 7 additions & 0 deletions packages/remix/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export declare const contextLinesIntegration: typeof clientSdk.contextLinesInteg
export declare const getDefaultIntegrations: (options: Options) => Integration[];
export declare const defaultStackParser: StackParser;

export declare function captureRemixServerException(
err: unknown,
name: string,
request: Request,
isRemixV2: boolean,
): Promise<void>;

// This variable is not a runtime variable but just a type to tell typescript that the methods below can either come
// from the client SDK or from the server SDK. TypeScript is smart enough to understand that these resolve to the same
// methods from `@sentry/core`.
Expand Down
Loading