File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
packages/nextjs/src/config Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -626,7 +626,38 @@ export function getWebpackPluginOptions(
626
626
627
627
checkWebpackPluginOverrides ( defaultPluginOptions , userPluginOptions ) ;
628
628
629
- return { ...defaultPluginOptions , ...userPluginOptions } ;
629
+ return {
630
+ ...defaultPluginOptions ,
631
+ ...userPluginOptions ,
632
+ errorHandler ( err , invokeErr , compilation ) {
633
+ // Hardcoded way to check for missing auth token until we have a better way of doing this.
634
+ if ( err && err . message . includes ( 'Authentication credentials were not provided.' ) ) {
635
+ const warningPrefix = `${ chalk . yellow ( 'warn' ) } -` ;
636
+ // eslint-disable-next-line no-console
637
+ console . warn (
638
+ `${ warningPrefix } ${
639
+ `${ chalk . bold ( 'No Sentry auth token configured.' ) } Source maps will not be uploaded.\n` +
640
+ 'You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\n' +
641
+ `After generating a Sentry auth token, set it via the ${ chalk . bold . cyan (
642
+ 'SENTRY_AUTH_TOKEN' ,
643
+ ) } environment variable during the build.\n`
644
+ } ${
645
+ process . env . VERCEL
646
+ ? "If you're deploying to Vercel, use the Vercel integration: https://vercel.com/integrations/sentry\n"
647
+ : ''
648
+ } `,
649
+ ) ;
650
+
651
+ return ;
652
+ }
653
+
654
+ if ( userPluginOptions . errorHandler ) {
655
+ return userPluginOptions . errorHandler ( err , invokeErr , compilation ) ;
656
+ }
657
+
658
+ return invokeErr ( ) ;
659
+ } ,
660
+ } ;
630
661
}
631
662
632
663
/** Check various conditions to decide if we should run the plugin */
You can’t perform that action at this time.
0 commit comments