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

The SENTRY_URL_PREFIX setting is deprecated #1309

Closed
drmrbrewer opened this issue Feb 7, 2022 · 50 comments · Fixed by getsentry/sentry#39804
Closed

The SENTRY_URL_PREFIX setting is deprecated #1309

drmrbrewer opened this issue Feb 7, 2022 · 50 comments · Fixed by getsentry/sentry#39804
Assignees

Comments

@drmrbrewer
Copy link
Contributor

Version

22.2.0.dev0

Steps to Reproduce

Install self-hosted sentry as per the guidance without changing anything.

Expected Result

No warning saying SENTRY_URL_PREFIX setting is deprecated

Actual Result

In the Sentry console I get the following banner at the top:

image

And clicking on that I see:

image

Warning text: The SENTRY_URL_PREFIX setting is deprecated. Please use SENTRY_OPTIONS['system.url-prefix'] instead.

But I don't (knowingly) use SENTRY_URL_PREFIX anywhere. I do enter details in the initial configuration screen you get when first loading up Sentry after installation, and that field was in fact pre-populated. But I don't manually set it up anywhere else or refer to it in the config. I can't even find any reference to this env var anywhere in the repo, so I'm not sure how to proceed or what other info to provide.

@chadwhitacre
Copy link
Member

Did you look for the envvar in the sentry codebase? Any clues there? 🤔

@drmrbrewer
Copy link
Contributor Author

Ah yes. But I can't see it as having been logged as an issue, unless it's hidden under something else. Shall I just ignore this warning and not make myself feel like I'm somehow doing something wrong?

@chadwhitacre
Copy link
Member

You mean logged into your Sentry instance as an issue? I wouldn't expect a deprecation warning to be filed as an error.

@chadwhitacre
Copy link
Member

Shall I just ignore this warning and not make myself feel like I'm somehow doing something wrong?

That, my friend, is a decision only you can make. I will support you fully either way! 😁

@drmrbrewer
Copy link
Contributor Author

wouldn't expect a deprecation warning to be filed as an error

I just thought you might want to be aware of it, seeing as though this warning must by triggered by something on your side, given that so far I've done nothing except install and run the default installation. Sorry to trouble you.

@chadwhitacre
Copy link
Member

Yeah, I did do some poking in sentry for SENTRY_URL_PREFIX. Here's where the DeprecationWarning is coming from. However, I don't find anywhere in self-hosted that we set SENTRY_URL_PREFIX. You've done a grep of your filesystem to see where this might be set in your environment?

@drmrbrewer
Copy link
Contributor Author

You've done a grep of your filesystem to see where this might be set in your environment?

Yep... zilch.

I know nothing about python, but isn't this bit setting SENTRY_URL_PREFIX?

I know it comes after the legacy check you referenced, but maybe this apply_legacy_settings() function is called again later, on settings that now include the legacy SENTRY_URL_PREFIX?

@chadwhitacre
Copy link
Member

Interesting hypothesis, cursory ag suggests not, but maybe?

tests/sentry/runner/test_initializer.py
4:from sentry.runner.initializer import apply_legacy_settings, bootstrap_options
168:def test_apply_legacy_settings(settings):
182:    apply_legacy_settings(settings)
206:    apply_legacy_settings(settings)
212:        apply_legacy_settings(settings)

src/sentry/runner/initializer.py
357:    apply_legacy_settings(settings)
524:def apply_legacy_settings(settings):

@marianhlavac
Copy link

I can confirm we have the same issue on clean installation of Sentry 22.1.0. The same warning message appears in the UI sporadically.

I haven't set the variable anywhere in the configs. Grepping the folder on fs where our sentry lives doesn't give any clues indicating the variable would be set anywhere.

❯ ssh s.sentry.xxx
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-1022-aws x86_64)
Last login: Sun Feb 13 13:35:47 2022 from xxx
ubuntu@ip-172-xxx:~$ cd sentry
ubuntu@ip-172-xxx:~/sentry$ grep SENTRY_URL_PREFIX -R .
./sentry_install_log-2022-02-08_18-35-53.txt:/usr/local/lib/python3.8/site-packages/sentry/runner/initializer.py:551: DeprecatedSettingWarning: The SENTRY_URL_PREFIX setting is deprecated. Please use SENTRY_OPTIONS['system.url-prefix'] instead.
ubuntu@ip-172-xxx:~/sentry$

@webmozart
Copy link

Same here with 22.2.0. I get the error but I don't find any occurrence of SENTRY_URL_PREFIX except for the source code of the warning.

@chadwhitacre
Copy link
Member

@nycterent
Copy link

i was not able to understand the reason, but setting system.url-prefix in config.yml got rid of this warning (which broke some monitoring scripts due to the unexpected output after sentry update :))

@chadwhitacre
Copy link
Member

Thanks for the workaround @nycterent!

Leaving this open as it seems we have a (small?) bug here. Does anyone know what version this might have been introduced in? Anyone see this on 21.12.0?

@chadwhitacre chadwhitacre pinned this issue Feb 18, 2022
@soroosh-chabi
Copy link

Thanks for the workaround @nycterent!

Leaving this open as it seems we have a (small?) bug here. Does anyone know what version this might have been introduced in? Anyone see this on 21.12.0?

As I recall, I first saw this on 22.1.0.

@idonda
Copy link

idonda commented Feb 21, 2022

Same here with 22.3.0.dev0 just installed

@chadwhitacre
Copy link
Member

Those are where we backport the new config to the old. Current best hypothesis is that this inadvertently triggers the warning. Need to validate.

@fourteentrees
Copy link

same here. After modding config,yml for the first time and restarting Sentry (docker-compose restart), we got that error consistently

We still get it. I've tried grepping / for the legacy setting. No luck.

@ascendify-engineering
Copy link

I just got the error, on updating to Sentry 22.3.0.dev0. We did not get the error on our previous version, 21.11.0.dev0.

@chadwhitacre
Copy link
Member

I dropped a line internally to see if we can get some movement on this.

@ghost
Copy link

ghost commented Mar 17, 2022

Thanks for the workaround @nycterent!

Leaving this open as it seems we have a (small?) bug here. Does anyone know what version this might have been introduced in? Anyone see this on 21.12.0?

According to install_log, first warning showed between upgrade 21.12.0 -> 22.1.0 and later.

@chadwhitacre
Copy link
Member

chadwhitacre commented Mar 17, 2022

Got one taker internally and nothing jumped out. Hard to prioritize as it is mostly a minor annoyance (yes?). 🐭

@webmozart
Copy link

I'm getting a cron email every day, so it's pretty annoying 😄 But if it's not going to be fixed quickly (as I expected), I'll apply a work around.

@chadwhitacre
Copy link
Member

I'm getting a cron email every day

Ouch! 😖

I'll apply a work around

Probably the right move, I'd love to dig into this myself but I don't see that happening soon. If anyone wants to be a hero and get to the bottom of this you will get mad internet points. :P

@bsjaga
Copy link

bsjaga commented Mar 23, 2022

I think this is because it can not access the routes with the given prefix.
So, I updated url-prefix with sentry's domain which is sentry.my-domain in my case
-> Go to self-hosted/sentry/config.yml
-> Replace system.internal-url-prefix: 'http://web:9000' with system.url-prefix: 'https://sentry.my-domain'

@AndreKR
Copy link

AndreKR commented Mar 25, 2022

I'm quite sure that SENTRY_URL_PREFIX corresponds to Admin > Settings > Root URL and that must be coming from the database because during the upgrade procedure we replace the complete file set, including config.yml, but after the upgrade it still contains the old value.

The GUI tells us that

image

but I think that is simply wrong.

@emmatyping
Copy link
Contributor

I will be tackling this issue in the coming weeks :)

@NaveenGovindraj
Copy link

We also have this same warning.
The SENTRY_URL_PREFIX setting is deprecated. Please use SENTRY_OPTIONS['system.url-prefix'] instead.
But in the config.yml file, I have used system.url-prefix: 'https://sentry.my-domain'

As a result, we are not able to add any SAML Auth integrations.

Sentry version: Sentry 22.8.0.dev0
07effca

@emmatyping
Copy link
Contributor

Ok, I traced the stack trace of the cause of the error, and it seems that the U2F auth code calls .get on the options manager twice due to multiple uwsgi workers. I'm not sure why this suddenly broken when it did, and I am not sure why it doesn't happen with SaaS however.

@johnsturgeon
Copy link

Can confirm that I'm getting the deprecation warning as well, since I do the GitHub integration 'auth' dance, I'm hesitant to change config.yml so I'll live with it, but it would be nice to get it cleaned up.

@hubertdeng123
Copy link
Member

hubertdeng123 commented Oct 5, 2022

Hey there, also investigating this issue. I'm having trouble replicating this in my setup. Are people encountering this issue after doing a clean install of self-hosted? I'm wondering if there is a more reliable way to get this warning, since I definitely have seen it before in the past.

@Vanav
Copy link

Vanav commented Oct 5, 2022

I have it on fresh install v22.9.0. Also after some time I got "Root URL" setting disabled, but I have not added it to config file. Maybe it is somehow related.

image
image

@johnsturgeon
Copy link

Hey there, also investigating this issue. I'm having trouble replicating this in my setup. Are people encountering this issue after doing a clean install of self-hosted? I'm wondering if there is a more reliable way to get this warning, since I definitely have seen it before in the past.

Yes, clean install

@hubertdeng123
Copy link
Member

thanks for the datapoints everyone

@idonda
Copy link

idonda commented Oct 6, 2022

self-hosted on ubuntu 20 22.3.0.dev0 updated to 22.9.0.dev0 same problem before and after.

@hubertdeng123
Copy link
Member

ok, I think this happens as a result of docker compose run --rm web upgrade being run more than once.
https://github.com/getsentry/sentry/blob/master/src/sentry/runner/initializer.py#L588

This line sets the SENTRY_URL_PREFIX if it doesn't exist, even if system.url-prefix is not being used

@hubertdeng123
Copy link
Member

hubertdeng123 commented Oct 7, 2022

Note, I'm not seeing it on a clean install (first run of ./install.sh), but I'm seeing it when ./install.sh is run again because of the docker compose run --rm web upgrade. It's definitely due to the initializer being run more than once.

hubertdeng123 added a commit to getsentry/sentry that referenced this issue Oct 7, 2022
…nfig value is not set (#39804)

This should fix getsentry/self-hosted#1309

After an initial run of `./install.sh`, self-hosted users are getting
the `SENTRY_URL_PREFIX` deprecation warning when the config value isn't
set. Turns out, we set `settings.SENTRY_URL_PREFIX` due to backwards
compatibility reasons. The solution here is to also set
`settings.SENTRY_OPTIONS["system.url-prefix"]` to avoid getting the
warning.
@hubertdeng123
Copy link
Member

still need to verify this, so reopening for now

@hubertdeng123 hubertdeng123 reopened this Oct 7, 2022
@hubertdeng123
Copy link
Member

hubertdeng123 commented Oct 8, 2022

I decided that the PR did not properly tackle the issue. It seems like the deprecation warning appears and then sets the system.url-prefix to behttp://sentry.example.com. This doesn't seem like it should be happening 🤔

@ssjunior
Copy link

Same situation here, fresh install using docker.

@hubertdeng123
Copy link
Member

I have a PR up here to address, just trying to figure out why e2e tests aren't passing:
getsentry/sentry#39932

hubertdeng123 added a commit to getsentry/sentry that referenced this issue Oct 19, 2022
…ecated (#39932)

Did a deep dive here and these are my findings:

getsentry/self-hosted#1309

- This warning shows when `system.url-prefix` is set in the database, so
after a user has filled in the initial login page to set the root url
- SENTRY_URL_PREFIX is not actually in the config, so this warning is
completely misleading and harmless
- SENTRY_URL_PREFIX is being set during the initialization of a worker
based on what value of `system.url-prefix` in the database. This can be
found on
[here](https://github.com/getsentry/sentry/blob/c9bbf4d09a8e4ca000fae99e9735f04f95c370aa/src/sentry/options/manager.py#L149)
- Combed through PR's from January and February and nothing indicates to
me that this ever was completely fixed

Co-authored-by: Chad Whitacre <chadwhitacre@sentry.io>
Co-authored-by: Ethan Smith <ethan@ethanhs.me>
@hubertdeng123
Copy link
Member

I just tested with the latest sentry image, this url deprecation warning should now no longer appear on self-hosted setups as a false positive.

@dashed
Copy link
Member

dashed commented Oct 19, 2022

@hubertdeng123 Thanks! This also no longer show up when doing make develop on sentry.

@hubertdeng123
Copy link
Member

@dashed glad it's working for you!

@chadwhitacre chadwhitacre unpinned this issue Oct 19, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet