@@ -2,6 +2,7 @@ import { RewriteFrames } from '@sentry/integrations';
22import { configureScope , getCurrentHub , init as nodeInit , Integrations } from '@sentry/node' ;
33import { hasTracingEnabled } from '@sentry/tracing' ;
44import { escapeStringForRegex , logger } from '@sentry/utils' ;
5+ import * as path from 'path' ;
56
67import { instrumentServer } from './utils/instrumentServer' ;
78import { MetadataBuilder } from './utils/metadataBuilder' ;
@@ -49,14 +50,19 @@ function sdkAlreadyInitialized(): boolean {
4950
5051function addServerIntegrations ( options : NextjsOptions ) : void {
5152 // This value is injected at build time, based on the output directory specified in the build config
52- const distDirRegex = ( global as typeof global & { __rewriteFramesRegex__ : string } ) . __rewriteFramesRegex__ ;
53- const SOURCEMAP_FILENAME_REGEX = new RegExp ( escapeStringForRegex ( distDirRegex ) ) ;
53+ const distDir = ( global as typeof global & { __rewriteFramesDistDir__ : string } ) . __rewriteFramesDistDir__ ;
54+ const SOURCEMAP_FILENAME_REGEX = new RegExp ( escapeStringForRegex ( path . resolve ( process . cwd ( ) , distDir ) ) ) ;
55+ // const distDirRegex = (global as typeof global & { __rewriteFramesRegex__: string }).__rewriteFramesRegex__;
56+ // const SOURCEMAP_FILENAME_REGEX = new RegExp(escapeStringForRegex(distDirRegex));
5457
55- console . log ( 'distDirRegex:' , distDirRegex ) ;
58+ // console.log('distDirRegex:', distDirRegex);
5659 console . log ( 'cwd in addServerIntegrations' , process . cwd ( ) ) ;
5760
5861 const defaultRewriteFramesIntegration = new RewriteFrames ( {
5962 iteratee : frame => {
63+ if ( frame . filename ?. includes ( 'throw' ) ) {
64+ debugger ;
65+ }
6066 frame . filename = frame . filename ?. replace ( SOURCEMAP_FILENAME_REGEX , 'app:///_next' ) ;
6167 return frame ;
6268 } ,
0 commit comments