Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 tasks done
billsbooth opened this issue Mar 18, 2024 · 17 comments
Closed
3 tasks done
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Stale Type: Bug

Comments

@billsbooth
Copy link

Is there an existing issue for this?

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)

@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Mar 18, 2024
@billsbooth
Copy link
Author

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)

@lforst
Copy link
Member

lforst commented Mar 18, 2024

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
Copy link
Member

lforst commented Mar 18, 2024

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.

@billsbooth
Copy link
Author

billsbooth commented Mar 18, 2024

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.

@lforst
Copy link
Member

lforst commented Mar 19, 2024

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.

@martian0x80
Copy link

martian0x80 commented May 14, 2024

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.

@lforst
Copy link
Member

lforst commented May 14, 2024

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

@martian0x80
Copy link

@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.

@lforst
Copy link
Member

lforst commented May 14, 2024

@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!

@getsantry
Copy link

getsantry bot commented Jun 6, 2024

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 getsantry bot added the Stale label Jun 6, 2024
@getsantry getsantry bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2024
@matija2209
Copy link

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

@kamyarkaviani
Copy link

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

@POD666
Copy link

POD666 commented Sep 12, 2024

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.

@matija2209
Copy link

matija2209 commented Sep 13, 2024 via email

@felangel
Copy link

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 ***

@lforst
Copy link
Member

lforst commented Sep 17, 2024

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

@felangel
Copy link

@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 getsentry/sentry-cli#2157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Stale Type: Bug
Projects
Archived in project
Archived in project
Development

No branches or pull requests

8 participants