@@ -29,6 +29,13 @@ interface SentryEnhancedNextData extends NextData {
29
29
pageProps ?: {
30
30
_sentryGetServerSidePropsTraceData ?: string ; // trace parent info, if injected by server-side `getServerSideProps`
31
31
_sentryGetServerSidePropsBaggage ?: string ; // baggage, if injected by server-side `getServerSideProps`
32
+
33
+ // The following two values are only injected in a very special case with the following conditions:
34
+ // 1. The page's `getStaticPaths` method must have returned `fallback: 'blocking'`.
35
+ // 2. The requested page must be a "miss" in terms of "Incremental Static Regeneration", meaning the requested page has not been generated before.
36
+ // In this case, a page is requested and only served when `getStaticProps` is done. There is not even a fallback page or similar.
37
+ _sentryGetStaticPropsTraceData ?: string ; // trace parent info, if injected by server-side `getStaticProps`
38
+ _sentryGetStaticPropsBaggage ?: string ; // baggage, if injected by server-side `getStaticProps`
32
39
} ;
33
40
} ;
34
41
}
@@ -81,16 +88,18 @@ function extractNextDataTagInformation(): NextDataTagInfo {
81
88
82
89
const getInitialPropsBaggage = props . _sentryGetInitialPropsBaggage ;
83
90
const getServerSidePropsBaggage = pageProps && pageProps . _sentryGetServerSidePropsBaggage ;
84
- // Ordering of the following shouldn't matter but `getInitialProps` generally runs before `getServerSideProps` so we give it priority.
85
- const baggage = getInitialPropsBaggage || getServerSidePropsBaggage ;
91
+ const getStaticPropsBaggage = pageProps && pageProps . _sentryGetStaticPropsBaggage ;
92
+ // Ordering of the following shouldn't matter but `getInitialProps` generally runs before `getServerSideProps` or `getStaticProps` so we give it priority.
93
+ const baggage = getInitialPropsBaggage || getServerSidePropsBaggage || getStaticPropsBaggage ;
86
94
if ( baggage ) {
87
95
nextDataTagInfo . baggage = baggage ;
88
96
}
89
97
90
98
const getInitialPropsTraceData = props . _sentryGetInitialPropsTraceData ;
91
99
const getServerSidePropsTraceData = pageProps && pageProps . _sentryGetServerSidePropsTraceData ;
92
- // Ordering of the following shouldn't matter but `getInitialProps` generally runs before `getServerSideProps` so we give it priority.
93
- const traceData = getInitialPropsTraceData || getServerSidePropsTraceData ;
100
+ const getStaticPropsTraceData = pageProps && pageProps . _sentryGetStaticPropsTraceData ;
101
+ // Ordering of the following shouldn't matter but `getInitialProps` generally runs before `getServerSideProps` or `getStaticProps` so we give it priority.
102
+ const traceData = getInitialPropsTraceData || getServerSidePropsTraceData || getStaticPropsTraceData ;
94
103
if ( traceData ) {
95
104
nextDataTagInfo . traceParentData = extractTraceparentData ( traceData ) ;
96
105
}
0 commit comments