40thieves / webpack-sentry-plugin

Webpack plugin to upload source maps to Sentry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sentry Plugin - StatusCodeError: 401 - "{\"detail\": \"Invalid token\"}"

devlemire opened this issue · comments

I've followed the documentation but cannot get past this error.

  • I've added the package to my package.json.
  • I've required the package at the top of my webpack.prod.conf.js.
  • I've configured the output of webpack for source maps:
   output: {
      path: config.build.assetsRoot,
      filename: utils.assetsPath('js/[name].js'),
      chunkFilename: utils.assetsPath('js/[id].js')
   },
  • I've added my new SentryPlugin to the array of plugins
      new SentryPlugin({
         // Sentry options are required
         organization: 'devmountain',
         project: 'basecamphub',
         apiKey: 'my_key',

         // Release version name/hash is required
         release: function(hash) {
            return hash // webpack build hash
         }
      })

I generated an API key under my User Settings -> Auth Tokens and gave my token all the possible scopes.

I'm not sure what I'm doing wrong here. I've read material that Auth Tokens are the new API keys? API keys were the old way?

Any help would be much appreciated. My build fails and always outputs:

ERROR in Sentry Plugin: StatusCodeError: 401 - "{\"detail\": \"Invalid token\"}"

  Build failed with errors.

error Command failed with exit code 1.
commented

I have the same problem.

commented

I have the same problem.

commented

if you have your own server , please config baseSentryURL: 'http://yourhost/api/0'

commented

I have resolved my problem. The old project's webpack version is 1.x, so i update it.

Sorry that I never responded to this issue -- @devlemire are you still having trouble with this? It's difficult for me to help here because we don't do anything fancy with authentication -- we just take your configured auth token and use it to make API calls to Sentry. So issues like this are likely to be something specific to your own configuration (especially if you self-host Sentry). I am closing this out for now, but feel free to follow up if you still have an issue and I can try to offer suggestions.

i also have this problem,Confused

// webpack
 new SentryPlugin({
            deleteAfterCompile: true, 
            organization: '***',
            project: '***',
            apiKey: '***',
            filenameTransform: function (filename) {
                return '~/' + filename 
            },
            release: '1.0', 
            suppressConflictError: true
          })