Skip to content

fix(nextjs): Use passthrough createReduxEnhancer on server #11005

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 1 commit into from
Mar 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
"@playwright/test": "^1.27.1",
"@sentry/nextjs": "latest || *",
"@types/node": "18.11.17",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
"next": "14.0.4",
"next": "14.1.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.5",
"wait-port": "1.0.4",
"ts-node": "10.9.1",
"@playwright/test": "^1.27.1"
"typescript": "4.9.5",
"wait-port": "1.0.4"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to clarify, are these new deps important/needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're not new. Yarn just auto sorted them. The only thing I did was bump the version the default e2e tests run with to the latest version. I think that is needed. At least it was to verify this bug.

},
"devDependencies": {
"@sentry/types": "latest || *",
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export declare const defaultStackParser: StackParser;
export declare function getSentryRelease(fallback?: string): string | undefined;

export declare const ErrorBoundary: typeof clientSdk.ErrorBoundary;
export declare const createReduxEnhancer: typeof clientSdk.createReduxEnhancer;
export declare const showReportDialog: typeof clientSdk.showReportDialog;
export declare const withErrorBoundary: typeof clientSdk.withErrorBoundary;

Expand Down
8 changes: 7 additions & 1 deletion packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { distDirRewriteFramesIntegration } from './distDirRewriteFramesIntegrati
import { Http } from './httpIntegration';
import { OnUncaughtException } from './onUncaughtExceptionIntegration';

export { createReduxEnhancer } from '@sentry/react';
export * from '@sentry/node-experimental';
export { captureUnderscoreErrorException } from '../common/_error';

Expand Down Expand Up @@ -47,6 +46,13 @@ export const ErrorBoundary = (props: React.PropsWithChildren<unknown>): React.Re
return props.children as React.ReactNode;
};

/**
* A passthrough redux enhancer for the server that doesn't depend on anything from the `@sentry/react` package.
*/
export function createReduxEnhancer() {
return (createStore: unknown) => createStore;
}

/**
* A passthrough error boundary wrapper for the server that doesn't depend on any react. Error boundaries don't catch
* SSR errors so they should simply be a passthrough.
Expand Down