Skip to content

Commit afbe522

Browse files
author
Luca Forstner
committed
Introduce isBuild check
1 parent cf22932 commit afbe522

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,5 +1,6 @@
11
import { GetServerSideProps } from 'next';
22

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

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

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)