sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Renaming project on sentry.io breaks all builds, no documentation to fix it, wizard does not fix it

Open billsbooth opened this issue 1 year ago • 9 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

7.105.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

  1. Install through wizard
  2. Rename project on sentry.io
  3. Confirm that nothing works and sentry is just breaking

Expected Result

Sentry works even if I rename the project; or at least, I get instructions on how to update my build system. You guys have zero documentation on this and it's so frustrating.

Actual Result

error: API request failed caused by: sentry reported an error: Invalid org token (http status: 401)

billsbooth avatar Mar 18 '24 00:03 billsbooth

Current error:

Failed to compile.

Sentry CLI Plugin: Command failed: ~/my-rojectproject/node_modules/@sentry/cli/sentry-cli releases new ZROnAryVksTKzne3HpizX
error: API request failed
  caused by: sentry reported an error: Invalid org token (http status: 401)

billsbooth avatar Mar 18 '24 00:03 billsbooth

Hi, sorry that this was frustrating. First to unblock you: Can you try creating a new auth token in Sentry and set it for your build? We encode things inside the auth token and when renaming the project things might desync.

Next, we'd like to fix the experience around this. Would you mind sharing your org slug so we can take a closer look at your setup? Thank you!

lforst avatar Mar 18 '24 10:03 lforst

Also, did you by any chance mean to write that you renamed your organization, and not the project? Because renaming the project should not have any effect on auth tokens.

lforst avatar Mar 18 '24 11:03 lforst

org slug is ferumlabs.

End up just deleting everything and starting over. I spent about an hour debugging it and got no where.

Things that were confusing:

  • I wasn't sure where the auth token was being set or how it worked overall. I checked the env variables; it wasn't there. I checked the .sentrycli, but then realized it's only used for the CLI but not for builds.
  • I double-checked that the DSN is the same across the web portal and all my configurations. I expected the DSN to be mostly a custom URL, but I wasn't expecting it to have anything to do with authentication (and it seems like it does).
  • DSN is also not a very popular term. Having something that's more like a "project token" would help.
  • I tried to create an auth token from the portal and move it to the builds process, but it seems like the web portal auth tokens are limited in scope, and I am not able to change it.
  • The wizard initiated the .sentrycli file, but I had neither installed sentry-cli nor was authenticated; once I installed it threw brew, it became confusing why the wizard added the parameters if I didn't have the tool.
  • I ran the wizard twice in hopes of fixing things, but it ended up duplicating lots of stuff; I cleaned it up, only leaving the more recent updates, and it still didn't work. a
  • Also, why is localhost logging enabled by default? While developing we have 100s of errors as react auto renders in error states.

The ideal state:

  1. Project name, slug, org name, org user, etc. are not tied to auth.
  2. There is a single project token (similar to mixpanel), that's set in env variables / or configs.
  3. That's it.

billsbooth avatar Mar 18 '24 17:03 billsbooth

Thanks for the detailed feedback. We are having a pretty big discussion internally on how to tie any tooling not to org slug but rather an id or even more ideal the token itself.

lforst avatar Mar 19 '24 12:03 lforst

Any updates on this?

I had a similar issue, I created a new project with the 'javascript-nextjs' template, and didn't rename it. I walked through the setup for setting up the SDK and connected it to the same project. Now, today I changed the project name (to 'ipusenpai'), and then I couldn't build in production. Tried changing auth-token, dsn, nothing worked.

This is a part of the logs:

Sentry CLI Plugin: Command failed: /vercel/path0/node_modules/@sentry/cli/sentry-cli releases new ********************************
  DEBUG   2024-05-14 11:06:11.254206210 +00:00 sentry-cli version: 1.77.3, platform: "linux", architecture: "x86_64"
  INFO    2024-05-14 11:06:11.254266144 +00:00 sentry-cli was invoked with the following command line: "/vercel/path0/node_modules/@sentry/cli/sentry-cli" "releases" "new" "****************************"
  DEBUG   2024-05-14 11:06:11.254533274 +00:00 request POST https://sentry.io/api/0/projects/ipu-senpai/**javascript-nextjs**/releases/
  DEBUG   2024-05-14 11:06:11.254545095 +00:00 pipeline: webpack-plugin/1.21.0
  DEBUG   2024-05-14 11:06:11.254553489 +00:00 using token authentication
  DEBUG   2024-05-14 11:06:11.254569480 +00:00 json body: {"version":"*******************","projects":["**javascript-nextjs**"],"dateStarted":"2024-05-14T11:06:11.254511154Z"}

It's still making the POST request with the old project name. And then throws this,

 DEBUG   2024-05-14 11:06:11.614001572 +00:00 body: {"slug":"ipusenpai","detail":{"code":"resource-moved","message":"Resource has been moved","extra":{"url":"/api/0/projects/ipu-senpai/ipusenpai/releases/","slug":"ipusenpai"}}}
error: project not found
  DEBUG   2024-05-14 11:06:11.614060253 +00:00 skipping update nagger because session is not attended
> Build failed because of webpack errors

The only solution I found was to rename it back to 'javascript-nextjs', and it worked.

martian0x80 avatar May 14 '24 11:05 martian0x80

@martian0x80 What do you have set as project in you next.config.js? Did you update the project there?

lforst avatar May 14 '24 11:05 lforst

@martian0x80 What do you have set as project in you next.config.js? Did you update the project there?

Thank you for the tip! I didn't update the next.config.mjs, I am sorry for wasting your time. Thank you again.

martian0x80 avatar May 14 '24 13:05 martian0x80

@martian0x80 I am absolutely certain you are not the only one running into this so no time wasted :) The next person will maybe find this thread be helpful!

lforst avatar May 14 '24 14:05 lforst

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Jun 06 '24 07:06 getsantry[bot]

Had the same issue. It's when you rename the project. You need to rename it in nextjs config.

matija2209 avatar Sep 04 '24 09:09 matija2209

If you rename the project, you'll have to run npx @sentry/wizard@latest -i nextjs again to retrieve new auth tokens.

kamyarkaviani avatar Sep 09 '24 20:09 kamyarkaviani

Just spent ~1h on this. Didn't know that teammate changed our project slug.

Would be nice if you highlight it somehow both in the build error message and in the web ui when somebody changes project slug.

POD666 avatar Sep 12 '24 22:09 POD666

I had to reinitialise the whole sentry project in NextJs to make it work.

Viktor Danyliuk @.***> schrieb am Fr., 13. Sept. 2024, 00:19:

Just spent ~1h on this. Didn't know that teammate changed our project slug.

Would be nice if you highlight it somehow both in the build error message and in the web ui when somebody changes project slug.

— Reply to this email directly, view it on GitHub https://github.com/getsentry/sentry-javascript/issues/11154#issuecomment-2347340635, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD53A2IAHZIWI3S5Q27CUYLZWIHPDAVCNFSM6AAAAABE2UXOBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBXGM2DANRTGU . You are receiving this because you commented.Message ID: @.***>

matija2209 avatar Sep 13 '24 06:09 matija2209

We ran into this using Remix and were not able to resolve the issue. Things we tried were:

  1. Re-generating an auth token
  2. Re-initializing the project via the sentry-cli
  3. Deleting the repository in the sentry dashboard
  4. Running the build step locally

Despite all the attempts we kept facing:

#14 21.72 [sentry-debug-id-upload-plugin] Command failed: /app/node_modules/@sentry/cli-linux-x64/bin/sentry-cli releases set-commits f091b72ff095031fc517da5133c11505bc4e21b5 --auto --ignore-missing
#14 21.72 error: could not find repository at '.'; class=Repository (6); code=NotFound (-3)
#14 21.72 
#14 21.72 Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
#14 21.72 Please attach the full debug log to all bug reports.
#14 21.72 
#14 21.72     at genericNodeError (node:internal/errors:984:15)
#14 21.72     at wrappedFn (node:internal/errors:538:14)
#14 21.72     at ChildProcess.exithandler (node:child_process:422:12)
#14 21.72     at ChildProcess.emit (node:events:519:28)
#14 21.72     at maybeClose (node:internal/child_process:1105:16)
#14 21.72     at ChildProcess._handle.onexit (node:internal/child_process:305:5) ***
#14 21.72   code: 'PLUGIN_ERROR',
#14 21.72   killed: false,
#14 21.72   signal: null,
#14 21.72   cmd: '/app/node_modules/@sentry/cli-linux-x64/bin/sentry-cli releases set-commits f091b72ff095031fc517da5133c11505bc4e21b5 --auto --ignore-missing',
#14 21.72   pluginCode: 1,
#14 21.72   plugin: 'sentry-debug-id-upload-plugin',
#14 21.72   hook: 'writeBundle'
#14 21.72 ***

felangel avatar Sep 16 '24 15:09 felangel

@felangel this seems like a different problem. Would you mind opening a new issue and fill out the template? Thanks!

lforst avatar Sep 17 '24 10:09 lforst

@felangel this seems like a different problem. Would you mind opening a new issue and fill out the template? Thanks!

Sure, created a new issue at https://github.com/getsentry/sentry-cli/issues/2157

felangel avatar Sep 17 '24 14:09 felangel