@@ -630,32 +630,80 @@ export function getWebpackPluginOptions(
630630 ...defaultPluginOptions ,
631631 ...userPluginOptions ,
632632 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-
637- let msg ;
638-
639- if ( process . env . VERCEL ) {
640- msg = `To fix this, use Sentry's Vercel integration to automatically set the ${ chalk . bold . cyan (
641- 'SENTRY_AUTH_TOKEN' ,
642- ) } environment variable: https://vercel.com/integrations/sentry`;
643- } else {
644- msg =
645- 'You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\n' +
646- `After generating a Sentry auth token, set it via the ${ chalk . bold . cyan (
633+ if ( err ) {
634+ const errorMessagePrefix = `${ chalk . red ( 'error' ) } -` ;
635+
636+ // Hardcoded way to check for missing auth token until we have a better way of doing this.
637+ if ( err . message . includes ( 'Authentication credentials were not provided.' ) ) {
638+ let msg ;
639+
640+ if ( process . env . VERCEL ) {
641+ msg = `To fix this, use Sentry's Vercel integration to automatically set the ${ chalk . bold . cyan (
647642 'SENTRY_AUTH_TOKEN' ,
648- ) } environment variable during the build.`;
643+ ) } environment variable: https://vercel.com/integrations/sentry`;
644+ } else {
645+ msg =
646+ 'You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\n' +
647+ `After generating a Sentry auth token, set it via the ${ chalk . bold . cyan (
648+ 'SENTRY_AUTH_TOKEN' ,
649+ ) } environment variable during the build.`;
650+ }
651+
652+ // eslint-disable-next-line no-console
653+ console . error (
654+ `${ errorMessagePrefix } ${ chalk . bold (
655+ 'No Sentry auth token configured.' ,
656+ ) } Source maps will not be uploaded.\n${ msg } \n`,
657+ ) ;
658+
659+ return ;
649660 }
650661
651- // eslint-disable-next-line no-console
652- console . error (
653- `${ warningPrefix } ${ chalk . bold (
654- 'No Sentry auth token configured.' ,
655- ) } Source maps will not be uploaded.\n${ msg } \n`,
656- ) ;
662+ // Hardcoded way to check for missing org slug until we have a better way of doing this.
663+ if ( err . message . includes ( 'An organization slug is required' ) ) {
664+ let msg ;
665+ if ( process . env . VERCEL ) {
666+ msg = `To fix this, use Sentry's Vercel integration to automatically set the ${ chalk . bold . cyan (
667+ 'SENTRY_ORG' ,
668+ ) } environment variable: https://vercel.com/integrations/sentry`;
669+ } else {
670+ msg = `To fix this, set the ${ chalk . bold . cyan (
671+ 'SENTRY_ORG' ,
672+ ) } environment variable to the to your organization slug during the build.`;
673+ }
674+
675+ // eslint-disable-next-line no-console
676+ console . error (
677+ `${ errorMessagePrefix } ${ chalk . bold (
678+ 'No Sentry organization slug configured.' ,
679+ ) } Source maps will not be uploaded.\n${ msg } \n`,
680+ ) ;
681+
682+ return ;
683+ }
657684
658- return ;
685+ // Hardcoded way to check for missing project slug until we have a better way of doing this.
686+ if ( err . message . includes ( 'A project slug is required' ) ) {
687+ let msg ;
688+ if ( process . env . VERCEL ) {
689+ msg = `To fix this, use Sentry's Vercel integration to automatically set the ${ chalk . bold . cyan (
690+ 'SENTRY_PROJECT' ,
691+ ) } environment variable: https://vercel.com/integrations/sentry`;
692+ } else {
693+ msg = `To fix this, set the ${ chalk . bold . cyan (
694+ 'SENTRY_PROJECT' ,
695+ ) } environment variable to the name of your Sentry project during the build.`;
696+ }
697+
698+ // eslint-disable-next-line no-console
699+ console . error (
700+ `${ errorMessagePrefix } ${ chalk . bold (
701+ 'No Sentry project slug configured.' ,
702+ ) } Source maps will not be uploaded.\n${ msg } \n`,
703+ ) ;
704+
705+ return ;
706+ }
659707 }
660708
661709 if ( userPluginOptions . errorHandler ) {
@@ -679,6 +727,10 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions
679727 // with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
680728 // try to build their apps.
681729 if ( ! SentryWebpackPlugin . cliBinaryExists ( ) ) {
730+ // eslint-disable-next-line no-console
731+ console . error (
732+ `${ chalk . red ( 'error' ) } - ${ chalk . bold ( 'Sentry CLI binary not found.' ) } Source maps will not be uploaded.\n` ,
733+ ) ;
682734 return false ;
683735 }
684736
0 commit comments