Skip to content

Commit d7fec7e

Browse files
committed
Introduce isBuild check
1 parent 5970fed commit d7fec7e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/nextjs/src/config/wrappers/withSentryGetServerSideProps.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { hasTracingEnabled } from '@sentry/tracing';
22
import { GetServerSideProps } from 'next';
33

4+
import { isBuild } from '../../utils/isBuild';
45
import { callTracedServerSideDataFetcher, withErrorInstrumentation } from './wrapperUtils';
56

67
/**
@@ -17,6 +18,10 @@ export function withSentryGetServerSideProps(
1718
return async function (
1819
...getServerSidePropsArguments: Parameters<GetServerSideProps>
1920
): ReturnType<GetServerSideProps> {
21+
if (isBuild()) {
22+
return origGetServerSideProps(...getServerSidePropsArguments);
23+
}
24+
2025
const [context] = getServerSidePropsArguments;
2126
const { req, res } = context;
2227

packages/nextjs/src/config/wrappers/withSentryServerSideGetInitialProps.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { hasTracingEnabled } from '@sentry/tracing';
22
import { NextPage } from 'next';
33

4+
import { isBuild } from '../../utils/isBuild';
45
import { callTracedServerSideDataFetcher, withErrorInstrumentation } from './wrapperUtils';
56

67
type GetInitialProps = Required<NextPage>['getInitialProps'];
@@ -19,6 +20,10 @@ export function withSentryServerSideGetInitialProps(
1920
return async function (
2021
...getInitialPropsArguments: Parameters<GetInitialProps>
2122
): Promise<ReturnType<GetInitialProps>> {
23+
if (isBuild()) {
24+
return origGetInitialProps(...getInitialPropsArguments);
25+
}
26+
2227
const [context] = getInitialPropsArguments;
2328
const { req, res } = context;
2429

0 commit comments

Comments
 (0)