Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

error: An organization slug is required (provide with --org) #60

Closed
rimlin opened this issue May 22, 2018 · 33 comments
Closed

error: An organization slug is required (provide with --org) #60

rimlin opened this issue May 22, 2018 · 33 comments

Comments

@rimlin
Copy link

rimlin commented May 22, 2018

Hi, trying to upload sourcemap to sentry, but catch this error:

    ERROR in Sentry CLI Plugin: Command failed: /node_modules/@sentry/cli/sentry-cli releases new <version>
    error: An organization slug is required (provide with --org)

There is how i use plugin:

new SentryCliPlugin({
  release: require(root('package.json')).version,
  include: '.',
  ignoreFile: root('.gitignore'),
  configFile: root('src/site/sentry.properties'),
  ignore: ['node_modules', 'webpack.config.js'],
}),

And there is sentry.properties file:

defaults.url = https://sentry.io/
defaults.org = <org slug>
defaults.project = <project>

auth.token = <token>

Tryed to set env variable directly (export SENTRY_ORG= <org slug>) and run webpack again, but catch new error:

    ERROR in Sentry CLI Plugin: Command failed: /node_modules/@sentry/cli/sentry-cli releases new <version>
    error: project not found

Version:
"@sentry/webpack-plugin": "^1.5.2",

@kamilogorek
Copy link
Contributor

Hey @rimlin, per docs https://docs.sentry.io/learn/cli/configuration/

The config file uses standard INI syntax.

Therefore your config should look like this:

[defaults]
url = https://sentry.io/
org = <org slug>
project = <project>

[auth]
token = <token>

@rimlin
Copy link
Author

rimlin commented May 23, 2018

@kamilogorek thanks for reply, changed my config to INI standart and renamed it to .sentryclirc but this not resolve the problem, again catch error:

    ERROR in Sentry CLI Plugin: Command failed: /node_modules/@sentry/cli/sentry-cli releases new <version>
    error: A project slug is required

So, i think what plugin could not find the config and use env variables, therefore i copied this config to project root and catch this error:

    ERROR in Sentry CLI Plugin: Command failed: /node_modules/@sentry/cli/sentry-cli releases new <version>
    error: project not found

Execution in project root node_modules/.bin/sentry-cli info print next:

Sentry Server: https://sentry.io
Default Organization: <org slug>
Default Project: <project>

Authentication Info:
  Method: Auth Token
  User: <email>
  Scopes:
    - project:write

Config file:

[defaults]
url = https://sentry.io/
org = <org slug>
project = <project>

[auth]
token = <token>

Plugin usage:

      new SentryCliPlugin({
        release: require(root('package.json')).version,
        include: '.',
        ignoreFile: root('.gitignore'),
        configFile: root('src/site/.sentryclirc'),
        ignore: ['node_modules', 'webpack.config.js'],
        debug: true
      }),

I tried to debug some info, but plugin nothing print except error

@kamilogorek
Copy link
Contributor

Hmm... error: project not found confirms that there's a connection to our servers. Are you certain that you're using correct data?

To verify this, you can use either SENTRY_ORG=<org> SENTRY_AUTH_TOKEN=<auth_token> sentry-cli projects list or sentry-cli login and then SENTRY_ORG=<org> sentry-cli projects list

Also, can you verify what root('src/site/.sentryclirc') is returning? (you can skip url from config file, it's default).

@mb8z
Copy link

mb8z commented May 24, 2018

I'm having a similar error. First it was related with wrong .sentryclirc setup, but now I have it like this:

[defaults]
org = my-org-name
project = my-project
[auth]
token = my-token

The token is from https://sentry.io/api/ api and it has options:

event:admin, event:read, member:read, org:read, project:read, project:releases, team:read, project:write

What I get is:

ERROR in Sentry CLI Plugin: Command failed: /Users/nyc/Desktop/Projects/new-metronom/node_modules/@sentry/cli/sentry-cli releases new 16d2f541259a64717202be50c73a5c7494548bf4
error: API request failed
  caused by: sentry reported an error: API key is not valid (http status: 401)

@kamilogorek Any ideas what I did wrong 😞 ?

@rimlin
Copy link
Author

rimlin commented May 25, 2018

@kamilogorek so, i could send sourcemaps to sentry, but for this i set my env varaibles SENTRY_ORG and SENTRY_PROJECT, because every time catch error: error: project not found

Command: SENTRY_ORG=<org> SENTRY_AUTH_TOKEN=<token> node_modules/.bin/sentry-cli projects list print me project list:

+-------------------+-----------+-------------------+
| Slug              | Team      | Name              |
+-------------------+-----------+-------------------+
| ...               | ....      | ...               |
+-------------------+-----------+-------------------+

@tavurth
Copy link

tavurth commented Jun 5, 2018

@rimlin I had this issue and changing the name from <my-org> to <sentry> fixed this issue. Perhaps you could check your organization name?

@kamilogorek
Copy link
Contributor

Closing due to inactivity. Feel free to reopen if still relevant.

@manekdilip
Copy link

@tavurth, where exactly do you insist to change the name ? Can you please provide the steps?

@tavurth
Copy link

tavurth commented Oct 25, 2018

@manekdilip

In my .sentryclirc file:

[defaults]
url = https://our-custom-sentry-url.com
org = sentry
project = project-name

[auth]
token = our-sentry-token

@nihp
Copy link

nihp commented Jan 23, 2020

How the .sentryclirc file will created?

@kamilogorek
Copy link
Contributor

You create it yourself from scratch

@gihan9a
Copy link

gihan9a commented Jan 30, 2020

You can use sentry-cli info to verify the settings.

@pckhoi
Copy link

pckhoi commented Feb 4, 2020

I have the same error. I try to run releases list and this is the result:

sentry-cli releases list --log-level=debug
  INFO    2020-02-04 17:44:11.460660 +07:00 Loaded config from /Users/khoipham/.sentryclirc
  DEBUG   2020-02-04 17:44:11.461941 +07:00 sentry-cli version: 1.49.0, platform: "darwin", architecture: "x86_64"
  INFO    2020-02-04 17:44:11.461969 +07:00 sentry-cli was invoked with the following command line: "sentry-cli" "releases" "list" "--log-level=debug"
  DEBUG   2020-02-04 17:44:11.466015 +07:00 request GET https://sentry.io/api/0/projects/wrgl/2232547/releases/
  DEBUG   2020-02-04 17:44:11.466349 +07:00 using token authentication
  DEBUG   2020-02-04 17:44:11.466378 +07:00 retry number 0, max retries: 0
  DEBUG   2020-02-04 17:44:12.085275 +07:00 > GET /api/0/projects/wrgl/2232547/releases/ HTTP/1.1
  DEBUG   2020-02-04 17:44:12.085309 +07:00 > Host: sentry.io
  DEBUG   2020-02-04 17:44:12.085321 +07:00 > Accept: */*
  DEBUG   2020-02-04 17:44:12.085330 +07:00 > Connection: TE
  DEBUG   2020-02-04 17:44:12.085339 +07:00 > TE: gzip
  DEBUG   2020-02-04 17:44:12.085348 +07:00 > User-Agent: sentry-cli/1.49.0
  DEBUG   2020-02-04 17:44:12.085963 +07:00 > Authorization: Bearer 7b3b5765***
  DEBUG   2020-02-04 17:44:12.336798 +07:00 < HTTP/1.1 404 Not Found
  DEBUG   2020-02-04 17:44:12.336830 +07:00 < Server: nginx
  DEBUG   2020-02-04 17:44:12.336841 +07:00 < Date: Tue, 04 Feb 2020 10:44:12 GMT
  DEBUG   2020-02-04 17:44:12.336849 +07:00 < Content-Type: application/json
  DEBUG   2020-02-04 17:44:12.336856 +07:00 < Content-Length: 50
  DEBUG   2020-02-04 17:44:12.336864 +07:00 < Connection: keep-alive
  DEBUG   2020-02-04 17:44:12.336873 +07:00 < Access-Control-Allow-Headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization
  DEBUG   2020-02-04 17:44:12.336880 +07:00 < X-Content-Type-Options: nosniff
  DEBUG   2020-02-04 17:44:12.336887 +07:00 < Content-Language: en
  DEBUG   2020-02-04 17:44:12.336893 +07:00 < Access-Control-Expose-Headers: X-Sentry-Error, Retry-After
  DEBUG   2020-02-04 17:44:12.336899 +07:00 < Vary: Accept-Language, Cookie
  DEBUG   2020-02-04 17:44:12.336905 +07:00 < X-XSS-Protection: 1; mode=block
  DEBUG   2020-02-04 17:44:12.336911 +07:00 < Allow: GET, POST, HEAD, OPTIONS
  DEBUG   2020-02-04 17:44:12.337017 +07:00 < Access-Control-Allow-Origin: *
  DEBUG   2020-02-04 17:44:12.337032 +07:00 < Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS
  DEBUG   2020-02-04 17:44:12.337045 +07:00 < X-Frame-Options: deny
  DEBUG   2020-02-04 17:44:12.337056 +07:00 < X-Served-By: web-0df6213e
  DEBUG   2020-02-04 17:44:12.337069 +07:00 < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
  DEBUG   2020-02-04 17:44:12.337143 +07:00 response status: 404
  DEBUG   2020-02-04 17:44:12.337200 +07:00 error: running update nagger
  INFO    2020-02-04 17:44:12.337538 +07:00 Skipping update nagger update check
error: project not found
  DEBUG   2020-02-04 17:44:12.338310 +07:00 client close; no transport to shut down  (from sentry)

@kamilogorek
Copy link
Contributor

@pckhoi there's no project with a name 2232547 in wrgl organization. Which is the config you use above.

@rturk
Copy link

rturk commented Feb 28, 2020

Why config file is required? Is possible to overcome this programmatically? And have settings explicitly in the webpack plugin declaration

@kamilogorek
Copy link
Contributor

It's not. See https://docs.sentry.io/cli/configuration/#configuration-values
You can use env variables for that purpose.

@jketcham
Copy link

I've been messing with this for about an hour and still can't get the webpack plugin to not throw an error.

Currently I'm getting: error: project not found

Here's how the plugin is called:

new SentryCliPlugin({
  include: 'dist',
  ignore: ['node_modules', 'webpack.config.js'],
  configFile: path.resolve(__dirname, '.sentryclirc'),
}),

My .sentryclirc file:

[auth]
token = xxx

[defaults]
project = xxx
org = xxx

When I run ./node_modules/@sentry/cli/bin/sentry-cli info I see the org and project that is set in the config file, and the authentication info is present and correct.

Not doing any self hosting, this is all on sentry.io. Webpack config file and sentry cli config file are at in the same directory. Using @sentry/webpack-plugin 1.10.0.

Any insights? Thanks!

@kamilogorek
Copy link
Contributor

@jketcham there's open PR fixing this getsentry/sentry-cli#700 (comment) :)

@javierguzman
Copy link

Hello @kamilogorek ! I see the PR has been merged. Do you know when is going to be available for the next release? I just grabbed webpack-plugin from using npm and I still have 1.10.0. I am just asking because it seems that my config file is not found properly even though I specify configFile option in the plugin.

Thank you in advance and regards

@kamilogorek
Copy link
Contributor

@javierguzman bumped all the versions. Can you retry?

@javierguzman
Copy link

Hello @kamilogorek

Still the same :(

I have the following configuration:

  new SentryWebpackPlugin({
    include: outputPath,
    configFile: path.resolve(configPath, '.sentryclirc'),
    ignore: ['node_modules', '.storybook', '.vscode', 'config', 'assets']
  }),

configPath is the folder where the config file is.

@kamilogorek
Copy link
Contributor

@javierguzman oh, that's .sentryclirc? Then I'll guess that you are most likely using ini format instead of properties as described here https://docs.sentry.io/learn/cli/configuration/#properties-files
If so, it should work just fine once you translate the file to a valid format.

@javierguzman
Copy link

@kamilogorek I think I am confused; My sentryclirc has the following format:
[defaults]
project=my-project
org=my-org

As far as I saw in the exact link you sent, this is the correct way, isn´t?

@kamilogorek
Copy link
Contributor

kamilogorek commented Apr 22, 2020

@javierguzman not really 😅

From README:

path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files

So your properties file should be:

defaults.project=my-project
defaults.org=my-org

@javierguzman
Copy link

@kamilogorek My bad, thanks!! I am getting now an API request failure but I will investigate that further before I ask around, but that error means that at least now the configuration is grabbed ok!
One last question, does this mean that I should place my defaults within ".sentryclirc" and then the properties itself in a "config.properties" file? Because I reading the docs at the beginning I though that .sentryclirc and .properties were interchangeable

@kamilogorek
Copy link
Contributor

does this mean that I should place my defaults within ".sentryclirc" and then the properties itself in a "config.properties" file?

Yes, you can do it this way.

Because I reading the docs at the beginning I though that .sentryclirc and .properties were interchangeable

The difference between these two formats/concepts, is that properties file can live anywhere and be configured using SENTRY_PROPERTIES env variable, thus it allows us to have things like configFile option in this webpack plugin. Where .sentryclirc is a fixed name, that's recursively searched for and automatically loaded when found.

@javierguzman
Copy link

@kamilogorek All clear then! At the very beginning I thought I could use .sentryclirc in the same way as the properties file that is why I even specified that in my webpack plugin configFile param. Now I have only a configSentry.properties file and that is. Thank you very much for your help Kamil.

@kamilogorek
Copy link
Contributor

Anytime! Glad I could help. Cheers

@phuocantd
Copy link

how to get org config?

@AdamDiament
Copy link

AdamDiament commented Jun 21, 2021

For others where the solution posted here didn't work, my CEO changed the org id and didn't tell me, check the org id you are passing in the .properties file is actually still correct!

@andreyqin
Copy link

@AdamDiament man, you just saved my day! This was the exact issue I've run into

@SimonSomlai
Copy link

I also stranded here whilst trying to figure what was going wrong with my sentry source map uploads. To debug my events that weren't matched, I was using the sentry-cli like so;

Screenshot 2022-06-08 at 10 01 48

So I was searching how I could add the organization slug to my source map uploads. But this error wasn't about the event, but for using the explain CLI functionality itself!!! Which confused me.

I had to pass additional parameters to the CLI script to get the actual problem with the event;

Screenshot 2022-06-08 at 10 04 20

Maybe this will help someone else who also skipped over the docs 😅

@amaze-escape
Copy link

amaze-escape commented Jan 30, 2023

For people who found the instructions for the CI/CD. This is how I changed the example to make it work.

I know this is not a webpack issue but CI/CD or CLI. But people with problems with the CLI might end up here as well, just like me.

curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="2.2.0" bash
SENTRY_AUTH_TOKEN=my-auth-token
SENTRY_ORG=my-organization
SENTRY_PROJECT=my-project
VERSION="v0.0.0"
sentry-cli releases new "$VERSION" --org "$SENTRY_ORG" --project "$SENTRY_PROJECT" --auth-token "$SENTRY_AUTH_TOKEN"
sentry-cli releases set-commits "$VERSION" --auto --org "$SENTRY_ORG" --project "$SENTRY_PROJECT" --auth-token "$SENTRY_AUTH_TOKEN"
sentry-cli releases finalize "$VERSION" --org "$SENTRY_ORG" --project "$SENTRY_PROJECT" --auth-token "$SENTRY_AUTH_TOKEN"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests