self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

24.8.0 When logging in for the first time, click Continue after completing the configuration. 400 error

Open haiboer97 opened this issue 1 year ago • 37 comments

Self-Hosted Version

24.8.0

CPU Architecture

x86_64

Docker Version

20.10.10

Docker Compose Version

2.29.2

Steps to Reproduce

When logging in for the first time, click Continue after completing the configuration. 400 error

/api/0/internal/options/?query=is:required 400 (Bad Request)

Expected Result

success login

Actual Result

[WARNING] django.request: Bad Request: /api/0/internal/options/ (status_code=400 request=<WSGIRequest: PUT '/api/0/internal/options/?query=is:required'>) [WARNING] django.request: Bad Request: /api/0/internal/options/ (status_code=400 request=<WSGIRequest: PUT '/api/0/internal/options/?query=is:required'>)

Event ID

No response

haiboer97 avatar Aug 28 '24 09:08 haiboer97

Image

haiboer97 avatar Aug 28 '24 09:08 haiboer97

400 means there is a field that you haven't fill in yet. From the screenshot, I can see that you haven't check one of "Send my contact information along with usage statistics" and "Please keep my usage information anonymous". Can you confirm that you've filled every fields?

aldy505 avatar Aug 29 '24 03:08 aldy505

I actually tried to check all the options, but the same error message still appeared. However, when I stayed on this page for a while without any operation, I could enter the main interface after refreshing. At this time, I needed to modify ADMIN--》settings--》Usage Statistics to make everything work properly. Otherwise, the error message would still appear when I logged in again next time.

haiboer97 avatar Aug 29 '24 05:08 haiboer97

Self-Hosted Version 24.8.0 24.7.1 CPU Architecture x86_64

Docker Version 20.10.21

Docker Compose Version 2.29.2

Steps to Reproduce When logging in for the first time, click Continue after completing the configuration. 400 error

/api/0/internal/options/?query=is:required 400 (Bad Request)

Expected Result success login

Same problem. It was resolved in the same way. just wait on the open tab for 10-15 minutes. Then I did as recommended by DMIN--》settings--》Usage Statistics

kovsienko avatar Aug 30 '24 09:08 kovsienko

Interesting, I'm not able to reproduce this issue on my side..

hubertdeng123 avatar Sep 03 '24 23:09 hubertdeng123

I am experiencing this issue too. I am running a brand new configuration of 24.8.0.

I cannot get past this page.

[!NOTE]
I submitted the form with all the fields selected. I just removed my email for the screenshot.

Image

jaydrogers avatar Sep 06 '24 18:09 jaydrogers

I am experiencing this issue too. I am running a brand new configuration of 24.8.0.

I cannot get past this page.

@jaydrogers I'm going to try to repro this during the weekend, but a quick question: How did you set things up? Is it just:

git clone https://github.com/getsentry/self-hosted.git
cd self-hosted
sudo ./install.sh

aldy505 avatar Sep 10 '24 03:09 aldy505

Thanks for checking it out. It's basically the steps that I followed other than configuring the sentry configs.

I did put a Traefik container in front of it for automated SSL, but I didn't see any evidence that it was Traefik or CloudFlare causing the issue.

Here is my docker-compose.overrride.yml:

services:
  nginx:
      ports: []
      labels:
       - "traefik.enable=true"
       - "traefik.docker.network=sentry_onpremise_default"
       - "traefik.http.routers.sentry.rule=Host(`myhost.example.com`)"
       - "traefik.http.routers.sentry.entrypoints=websecure"
       - "traefik.http.routers.sentry.tls=true"
       - "traefik.http.routers.sentry.tls.certresolver=letsencryptresolver"
       - "traefik.http.services.sentry.loadbalancer.server.port=80"
       - "traefik.http.services.sentry.loadbalancer.server.scheme=http"

  traefik:
    image: traefik:v3.1
    container_name: traefik
    restart: always
    networks:
        - default
    ports:
      # Listen on port 80, default for HTTP, necessary to redirect to HTTPS
      - target: 80
        published: 80
        mode: host
      # Listen on port 443, default for HTTPS
      - target: 443
        published: 443
        mode: host
    logging:
      driver: journald
      options:
        tag: traefik
    volumes:
      # Add Docker as a mounted volume, so that Traefik can read the labels of other services
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik.yml:/traefik.yml:ro
      - traefik-certificates:/certificates/


networks:
  default:

volumes:
  traefik-certificates:

My traefik config was pretty basic other than some CloudFlare configs to restore original IP addresses:

# Cloudflare TrustedIPs
x-trustedIps: &trustedIPs
  - "173.245.48.0/20"
  - "103.21.244.0/22"
  - "103.22.200.0/22"
  - "103.31.4.0/22"
  - "141.101.64.0/18"
  - "108.162.192.0/18"
  - "190.93.240.0/20"
  - "188.114.96.0/20"
  - "197.234.240.0/22"
  - "198.41.128.0/17"
  - "162.158.0.0/15"
  - "104.16.0.0/13"
  - "104.24.0.0/14"
  - "172.64.0.0/13"
  - "131.0.72.0/22"
  - "2400:cb00::/32"
  - "2606:4700::/32"
  - "2803:f800::/32"
  - "2405:b500::/32"
  - "2405:8100::/32"
  - "2a06:98c0::/29"
  - "2c0f:f248::/32"

serversTransport:
  insecureSkipVerify: true

providers:
  docker:
    exposedByDefault: false
    network: sentry_sentry-self-hosted_default

entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entrypoint:
          to: websecure
          scheme: https
    forwardedHeaders:
      trustedIPs: *trustedIPs
    proxyProtocol:
      trustedIPs: *trustedIPs

  websecure:
    address: ":443"
    forwardedHeaders:
      trustedIPs: *trustedIPs
    proxyProtocol:
      trustedIPs: *trustedIPs

accessLog: {}
log:
  level: ERROR

api:
  dashboard: true
  insecure: true

certificatesResolvers:
  letsencryptresolver:
    acme:
      email: "[email protected]"
      storage: "/certificates/acme.json"
      httpChallenge:
        entryPoint: web

Just a heads up

I did head a different direction than setting up a self-hosted Sentry, but I wanted to share the details of my experience in case it helped others 👍

jaydrogers avatar Sep 10 '24 17:09 jaydrogers

Hi everyone, I had the same problem for the clean installation and k8s. Found this error in the console: Image So, I commented a mail section in the helm chart, redeployed the chart, and passed this screen without any problems.

wooch82 avatar Sep 18 '24 09:09 wooch82

I have the same problem with versions 24.7.1, 24.8.0, 24.9.0

UPD: Really!!! after I commented the mail.use-ssl: false line in the sentry/config.yml file - the problem disappeared

djooberlee avatar Sep 18 '24 11:09 djooberlee

UPD: Really!!! after I commented the mail.use-ssl: false line in the sentry/config.yml file - the problem disappeared

@djooberlee Just to confirm, does the SMTP server you're using does not use any TLS protocol (no STARTTLS or anything, just plain text)? If that works, maybe we can update the config/documentation about this.

aldy505 avatar Sep 21 '24 01:09 aldy505

@aldy505 We use TLS. Previously, SSL was explicitly listed as disabled, but now I just commented out the line

this is how it looks now

mail.backend: 'smtp'
mail.host: 'smtp.example.com'
mail.port: 587
mail.username: '[email protected]'
mail.password: 'PASSWORD'
mail.use-tls: True
#mail.use-ssl: false
mail.from: '[email protected]'
mail.enable-replies: False
mail.reply-hostname: ''

djooberlee avatar Sep 21 '24 04:09 djooberlee

@aldy505 We use TLS. Previously, SSL was explicitly listed as disabled, but now I just commented out the line

this is how it looks now

mail.backend: 'smtp' mail.host: 'smtp.example.com' mail.port: 587 mail.username: '[email protected]' mail.password: 'PASSWORD' mail.use-tls: True #mail.use-ssl: false mail.from: '[email protected]' mail.enable-replies: False mail.reply-hostname: ''

Ah I see, I suppose mail.use-tls and mail.use-ssl is a mutually exclusive configuration? But that's a really good discovery.

aldy505 avatar Sep 21 '24 04:09 aldy505

It turned out, it is a mutually exclusive configuration:

Image

See Django's docs: https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-EMAIL_USE_TLS

aldy505 avatar Sep 21 '24 04:09 aldy505

It is clear that I cannot set both parameters to TRUE:

mail.use-tls: true
mail.use-ssl: true

But I never did!!!

And it is not clear to me from the documentation that it is not possible to explicitly set:

mail.use-tls: true
mail.use-ssl: false

or

mail.use-tls: false
mail.use-ssl: true

djooberlee avatar Sep 21 '24 10:09 djooberlee

Yeah we need to document this better.

aldy505 avatar Sep 21 '24 11:09 aldy505

I am experiencing this issue too. I am running a brand new configuration of 24.8.0.

I cannot get past this page.

Note

I submitted the form with all the fields selected. I just removed my email for the screenshot.

Image

Have the same issue (App 24.7.1)

vld1234 avatar Oct 09 '24 11:10 vld1234

@vld1234 Sorry for the very late reply, are you still facing the issue? Or is the workaround works for you?

Also, I've document this: https://github.com/getsentry/self-hosted/pull/3368

aldy505 avatar Nov 12 '24 06:11 aldy505

@vld1234 Sorry for the very late reply, are you still facing the issue? Or is the workaround works for you?

Also, I've document this: #3368

I've tried with different versions, the same issue.

vld1234 avatar Nov 12 '24 09:11 vld1234

@vld1234 Sorry for the very late reply, are you still facing the issue? Or is the workaround works for you? Also, I've document this: #3368

I've tried with different versions, the same issue.

@vld1234 What does your sentry/config.yml configuration looks like? Have you make sure that only one of mail.use-tls and mail.use-ssl uncommented as seen here? https://github.com/getsentry/self-hosted/blob/6a8c3a47587bf23847e51a7de3a21d152f1b7064/sentry/config.example.yml#L15-L18

Also, after changing that configuration file, have you re-run ./install.sh script?

If that still doesn't help, what kind of workarounds have you tried?

aldy505 avatar Nov 12 '24 09:11 aldy505

I have the same problem, comment mail.use-tls and reinstall doesn't help.

[WARNING] django.request: Bad Request: /api/0/internal/options/ (status_code=400 request=<WSGIRequest: PUT '/api/0/internal/options/?query=is:required'>) Image

I also have another Sentry installation, where both options uncommented and no such problem.

gwyn-bl avatar Nov 13 '24 13:11 gwyn-bl

Going to backlog this, thanks

hubertdeng123 avatar Nov 14 '24 20:11 hubertdeng123

I have the same problem, comment mail.use-tls and reinstall doesn't help.

@hubertdeng123 , sorry for misleading, it was problem with my configuration. My email config was in sentry.conf.py and even when I commented mail.use-tls there, it somehow getting it anyway, according to logs

[INFO] sentry: options.update (ip_address=' ' user_id=1 option_key='mail.use-tls' option_value=False)
[WARNING] django.request: Bad Request: /api/0/internal/options/ (status_code=400 request=<WSGIRequest: PUT '/api/0/internal/options/?query=is:required'>)

Moved back email configuration into config.yml and it works.

gwyn-bl avatar Nov 18 '24 09:11 gwyn-bl

Also, after changing that configuration file, have you re-run ./install.sh script?

If that still doesn't help, what kind of workarounds have you tried?

Hi, it was helm chart: backend: smtp useTls: true useSsl: false username: "" password: "" port: 587 host: "aaaaaaa.amazonaws.com" from: "aaaaaaa.com"

vld1234 avatar Nov 18 '24 14:11 vld1234

@vld1234

Also, after changing that configuration file, have you re-run ./install.sh script? If that still doesn't help, what kind of workarounds have you tried?

Hi, it was helm chart: backend: smtp useTls: true useSsl: false username: "" password: "" port: 587 host: "aaaaaaa.amazonaws.com" from: "aaaaaaa.com"

Hi, check my answer (they probably answer that they don't support chart). Try to move mail config from sentry.conf.py to config.yml, like in compose installation: https://github.com/getsentry/self-hosted/blob/6a8c3a47587bf23847e51a7de3a21d152f1b7064/sentry/config.example.yml#L10

gwyn-bl avatar Nov 18 '24 14:11 gwyn-bl

Also, after changing that configuration file, have you re-run ./install.sh script? If that still doesn't help, what kind of workarounds have you tried?

Hi, it was helm chart: backend: smtp useTls: true useSsl: false username: "" password: "" port: 587 host: "aaaaaaa.amazonaws.com" from: "aaaaaaa.com"

You have both useTls and useSsl set. There should be only one of that being set, and the other should be left commented. Please refer to the documentation comment here https://github.com/getsentry/self-hosted/blob/6a8c3a47587bf23847e51a7de3a21d152f1b7064/sentry/config.example.yml#L15-L18

Also yeah, if commenting one of useTls or useSsl still didn't work, and you've set it on the config.yml file and it still didn't work, try to open an issue on the helm chart repo instead.

aldy505 avatar Nov 19 '24 02:11 aldy505

Also, after changing that configuration file, have you re-run ./install.sh script? If that still doesn't help, what kind of workarounds have you tried?

Hi, it was helm chart: backend: smtp useTls: true useSsl: false username: "" password: "" port: 587 host: "aaaaaaa.amazonaws.com" from: "aaaaaaa.com"

Hi! just use default values in chart:

mail:
  backend: dummy  
  useTls: false   
  useSsl: false   
  username: ""   
  password: ""   
  port: 25   
  host: ""   
  from: ""

and after succes first install you'll can tap to 'continue' and after do upgrade chart with your config

tyr1k avatar Dec 04 '24 06:12 tyr1k

You have both useTls and useSsl set. There should be only one of that being set, and the other should be left commented. Please refer to the documentation comment here

Commenting one out will make the helm deployment fail - I just had the issue.

I set it to true for both, then afterwards, went back in and set useSsl to false.

Error from the browser if useTls: true and useSsl: false on initial installation, will produce a question on the welcome screen which you can then not pass and get the 400 error:

{error: "immutable_option", errorDetail: {option: "mail.use-ssl",…}}
error
: 
"immutable_option"
errorDetail
: 
{option: "mail.use-ssl",…}
message
: 
"'mail.use-ssl' cannot be changed at runtime because it is configured on disk"
option
: 
"mail.use-ssl"

madchap avatar Dec 31 '24 06:12 madchap

@madchap I think the issue is due to you having both of those variables set (even if one of them is set to false). From what I understand from @aldy505's comment above, only one of those settings should exist regardless of their value.

All that said, I think we should make the welcome UI handle this issue gracefully, instead of silently failing.

BYK avatar Dec 31 '24 11:12 BYK

@madchap I think the issue is due to you having both of those variables set (even if one of them is set to false). From what I understand from @aldy505's comment above, only one of those settings should exist regardless of their value.

All that said, I think we should make the welcome UI handle this issue gracefully, instead of silently failing.

I didn't try to set one to empty, but commenting the useSsl altogether in the case of sentry-kubernetes made the deployment fail. Possibly not a problem with your project then, but with the other. Cheers @BYK and happy new year.

madchap avatar Dec 31 '24 12:12 madchap