getsentry / sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
https://sentry.io
BSD 3-Clause "New" or "Revised" License
141 stars 36 forks source link

API request failed: Invalid org token (http status 401) #588

Closed AndersCV closed 3 months ago

AndersCV commented 3 months ago

Environment

"vue": "^3.4.25",
"nuxt": "3.11.2",
"@sentry/node": "^8.25.0",
"@sentry/profiling-node": "^8.25.0",
"@sentry/vite-plugin": "^2.22.0",
"@sentry/vue": "^8.25.0",

Steps to Reproduce

Build project with the following vite configuration:

vite: {
    plugins: [
      sentryVitePlugin({
        disable: !process.env.SENTRY_AUTH_TOKEN,
        sourcemaps: {
          filesToDeleteAfterUpload: '*.map',
        },
        org: process.env.SENTRY_ORG,
        project: process.env.SENTRY_PROJECT,
        authToken: process.env.SENTRY_AUTH_TOKEN,
      }),
    ],
  },
# Sentry configs
SENTRY_ORG=my-org
SENTRY_PROJECT=my-project
SENTRY_AUTH_TOKEN=my-auth-token
SENTRY_ENV=production
SENTRY_ENABLED=true
SENTRY_DSN=https://my-dsn

I double checked all my env variables and they are all correctly set. I found this issue from the Android SDK: https://github.com/getsentry/sentry-android-gradle-plugin/issues/694 perhaps cpuld be the same issue here? We are using EU data region as well in our organization.

Expected Result

Sentry vite plugin should upload source maps correctly.

Actual Result

Image

lforst commented 3 months ago

Hi, this looks off! I know you wrote that you double checked all your env vars but can you check again that you didn't fatfinger the auth token and also that you used the auth token from the right org?

Also, can you share the first few 10 or so characters from your auth token, and you can also verify your token by base64 decoding the token delimited by _ characters.

AndersCV commented 3 months ago

I can confirm creating a new org and setting data region to US fixed the problem and sourcemaps are uploaded correctly: Image

Please have a look at this ASAP - very critical for js applications hosted in EU using the vite plugin

@lforst

lforst commented 3 months ago

@AndersCV Have you already tried creating a new token for the EU region?

AndersCV commented 3 months ago

@lforst I tried creating a new token for the EU region and it worked! I'm sorry I must have somehow used an incorrect AUTH_TOKEN.

This issue can be closed - perhaps it's worth pointing out the error message I received is indicating the org token is invalid and not the auth token which consufed me.

Thanks for the help!