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.89k stars 1.77k forks source link

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

Open haiboer97 opened 2 months ago

haiboer97 commented 2 months ago

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 commented 2 months ago

Image

aldy505 commented 2 months ago

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?

haiboer97 commented 2 months ago

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.

kovsienko commented 2 months ago

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

hubertdeng123 commented 2 months ago

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

jaydrogers commented 2 months ago

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

aldy505 commented 2 months ago

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
jaydrogers commented 2 months ago

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: "myemail@example.com"
      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 👍

wooch82 commented 1 month ago

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.

djooberlee commented 1 month ago

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

aldy505 commented 1 month ago

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.

djooberlee commented 1 month ago

@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: 'sender@example.com'
mail.password: 'PASSWORD'
mail.use-tls: True
#mail.use-ssl: false
mail.from: 'sentry@example.com'
mail.enable-replies: False
mail.reply-hostname: ''
aldy505 commented 1 month ago

@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: 'sender@example.com' mail.password: 'PASSWORD' mail.use-tls: True

mail.use-ssl: false

mail.from: 'sentry@example.com' 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 commented 1 month ago

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

djooberlee commented 1 month ago

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
aldy505 commented 1 month ago

Yeah we need to document this better.

vld1234 commented 1 month ago

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)