Skip to content

Gatsby build fails when run locally without SENTRY_AUTH_TOKEN #7852

@abemedia

Description

@abemedia

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.

@sentry/gatsby

SDK Version

7.47.0

Framework Version

gatsby ^5.8.1, react 18.2.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
  dsn: 'my_dsn',
  release: 'my_release',
  environment: 'my_environment',
})

Steps to Reproduce

Run gatsby build (without setting SENTRY_AUTH_TOKEN) on my local machine.

Expected Result

The site builds, skipping the upload of sitemaps or creation of release (this works fine on my CI).

Actual Result

Fails the build with the following error message:

failed Building production JavaScript and CSS bundles - 25.753s

 ERROR #98123  WEBPACK.BUILD-JAVASCRIPT

Generating JavaScript bundles failed

Sentry CLI Plugin: Command failed: /home/adam/Work/optimus/optimusmine.com/node_modules/@sentry/cli/sentry-cli releases new 5ef49904f28dae3baa2d66773a83443f2df58cef
error: API request failed
  caused by: sentry reported an error: Authentication credentials were not provided. (http status: 401)

Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.

Not sure why this is happening locally but not on GitHub Actions but a simple fix might be to handle that error in https://github.com/getsentry/sentry-javascript/blob/develop/packages/gatsby/gatsby-node.js#L48-L54

Metadata

Metadata

Assignees

Labels

Package: gatsbyIssues related to the Sentry Gatsby SDK

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions