getsentry / self-hosted

Sentry, feature-complete and packaged up for low-volume deployments and proofs-of-concept
https://develop.sentry.dev/self-hosted/
Other
7.65k stars 1.74k forks source link

Self hosted login opens wrong url #2998

Open JeremiaAu opened 4 months ago

JeremiaAu commented 4 months ago

Environment

self-hosted Sentry

Windows Computer sentry-cli-Windows-x86_64.exe version 2.30.5

Steps to Reproduce

Using the command Line:

sentry-cli-Windows-x86_64.exe --url https://sentry.example.com/ login

This helps you signing in your sentry-cli with an authentication token. If you do not yet have a token ready we can bring up a browser for you to create a token now.

Sentry server: sentry.example.com Open browser now? [y/n] y

Expected Result

Relevant Settings Page pops up.

e.g.: https://sentry.example.com/settings/account/api/auth-tokens/ or: https://sentry.example.com/settings/[org-slug]/auth-tokens/

Actual Result

"Page Not Found" https://sentry.example.com/orgredirect/organizations/:orgslug/settings/auth-tokens/

szokeasaurusrex commented 4 months ago

@JeremiaAu what version of Sentry self-hosted are you using? If you are on an older version, it is possible that the sentry-cli login command is not compatible with your self-hosted instance, since the URL for generating a token is different in the older version.

JeremiaAu commented 4 months ago

I use the most recent version: 24.4.1

szokeasaurusrex commented 4 months ago

Okay, thanks for confirming, @JeremiaAu.

I was able to reproduce this problem by running the Sentry development server locally, then running the login command directed at the development server's URL, like so:

sentry-cli --url=http://localhost:8000 login

I suspect that this issue is caused by a problem in the Sentry backend, not the CLI, since the command works fine against Sentry SaaS. So, I am transferring this issue to the getsentry/sentry repository, so the team that maintains the Sentry backend can try to investigate this issue.

To whoever triages this issue in getsentry/sentry: please reach out to me if you determine that any changes are needed in the CLI.

getsantry[bot] commented 4 months ago

Assigning to @getsentry/support for routing ⏲️

azaslavsky commented 3 months ago

Just to be clear: the literal URL it is redirecting to is https://sentry.example.com/orgredirect/organizations/:orgslug/settings/auth-tokens/, or does it actually correctly sub in your org slug for :orgslug?

JeremiaAu commented 3 months ago

Yes, that is the literal URL.

hubertdeng123 commented 3 months ago

@szokeasaurusrex Since you have context here, do you have a recommendation on which team this issue should go to? This is a self-hosted specific issue but we don't work with this part of the codebase.

JeremiaAu commented 3 months ago

I think it would be easiest for the sentry-cli team to replace the current URL with the following one, since it has no orgslug: https://sentry.example.com/settings/account/api/auth-tokens/

hubertdeng123 commented 3 months ago

@szokeasaurusrex What do you think about this?

houssemamiri-logient commented 2 months ago

Does any one have temporary solution for this ?

JeremiaAu commented 2 months ago

Does any one have temporary solution for this ?

You could just create the file by hand: https://docs.sentry.io/cli/configuration/#to-authenticate-manually