[Bug]: receive error when try to login with identity provider.
Preflight Checklist
- I could not find a solution in the documentation, the existing issues or discussions
- I have joined the ZITADEL chat
Environment
Self-hosted
Version
latest (4.15.2)
Database
PostgreSQL
Database Version
17
Describe the problem caused by this bug
I configured Active Directory as identity provider. When I press the button to login with my idP as shown in the screenshot below.
I receive the following error on UI:
What is interesting is that if I interact with language selection form(For example choose English instead of English) and press try again, everything works as expected.
To reproduce
- Install latest Zitadel version in docker with Traefik that handles TLS termination.
- Configure Active Directory identity provider.
- Try to login with Active Directory.
Screenshots
No response
Expected behavior
I expect Zitadel to move users to LDAP login without any errors
Operating System
Device: Fedora 44/Windows 11 Browser: Chrome, Mozilla
Relevant Configuration
docker-compose.yml :
services:
traefik:
image: traefik:v3.6
restart: unless-stopped
networks:
- proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro
- ./traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro
- ./traefik/certs:/etc/traefik/certs:ro
db:
image: 'postgres:17-alpine'
container_name: zitadel_db
restart: unless-stopped
environment:
PGUSER: postgres
POSTGRES_PASSWORD: SomeSecretOfMine
POSTGRES_DB: zitadel
healthcheck:
test:
- CMD-SHELL
- 'pg_isready -d zitadel -U postgres'
interval: 10s
timeout: 30s
retries: 5
start_period: 20s
volumes:
- './data/postgres:/var/lib/postgresql/data'
networks:
- zitadel
zitadel:
image: 'ghcr.io/zitadel/zitadel:latest'
container_name: zitadel
restart: unless-stopped
command: 'start-from-init --masterkey "SomeSecretOfMine" --tlsMode external'
environment:
ZITADEL_EXTERNALDOMAIN: zitadel.customdomain.com
ZITADEL_EXTERNALPORT: '443'
ZITADEL_EXTERNALSECURE: 'true'
ZITADEL_TLS_ENABLED: 'false'
ZITADEL_DATABASE_POSTGRES_HOST: db
ZITADEL_DATABASE_POSTGRES_PORT: 5432
ZITADEL_DATABASE_POSTGRES_DATABASE: zitadel
ZITADEL_DATABASE_POSTGRES_USER_USERNAME: zitadel
ZITADEL_DATABASE_POSTGRES_USER_PASSWORD: zitadel
ZITADEL_DATABASE_POSTGRES_USER_SSL_MODE: disable
ZITADEL_DATABASE_POSTGRES_ADMIN_USERNAME: postgres
ZITADEL_DATABASE_POSTGRES_ADMIN_PASSWORD: SomeSecretOfMine
ZITADEL_DATABASE_POSTGRES_ADMIN_SSL_MODE: disable
ZITADEL_DEFAULTINSTANCE_FEATURES_LOGINV2_REQUIRED: 'true'
ZITADEL_DEFAULTINSTANCE_FEATURES_LOGINV2_BASEURI: 'https://zitadel.customdomain.com/ui/v2/login'
ZITADEL_OIDC_DEFAULTLOGINURLV2: 'https://zitadel.customdomain.com/ui/v2/login/login?authRequest='
ZITADEL_OIDC_DEFAULTLOGOUTURLV2: 'https://zitadel.customdomain.com/ui/v2/login/logout?post_logout_redirect='
ZITADEL_SAML_DEFAULTLOGINURLV2: 'https://zitadel.customdomain.com/ui/v2/login/login?samlRequest='
ZITADEL_FIRSTINSTANCE_LOGINCLIENTPATPATH: /current-dir/login-client.pat
ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORDCHANGEREQUIRED: 'false'
ZITADEL_FIRSTINSTANCE_ORG_LOGINCLIENT_MACHINE_USERNAME: login-client
ZITADEL_FIRSTINSTANCE_ORG_LOGINCLIENT_MACHINE_NAME: 'Automatically Initialized IAM_LOGIN_CLIENT'
ZITADEL_FIRSTINSTANCE_ORG_LOGINCLIENT_PAT_EXPIRATIONDATE: '2029-01-01T00:00:00Z'
ZITADEL_FIRSTINSTANCE_PATPATH: /current-dir/admin.pat
ZITADEL_FIRSTINSTANCE_ORG_MACHINE_MACHINE_USERNAME: admin
ZITADEL_FIRSTINSTANCE_ORG_MACHINE_MACHINE_NAME: 'Automatically Initialized IAM_OWNER'
ZITADEL_FIRSTINSTANCE_ORG_MACHINE_MACHINEKEY_TYPE: 1
ZITADEL_FIRSTINSTANCE_ORG_HUMAN_USERNAME: root
ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORD: SomeSecretOfMine123!
ZITADEL_FIRSTINSTANCE_ORG_NAME: SomeOrg
SSL_CERT_FILE: /etc/ssl/certs/combinedCerts.crt
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/combinedCerts.crt
user: '0:0'
healthcheck:
test:
- CMD
- /app/zitadel
- ready
interval: 10s
timeout: 60s
retries: 5
start_period: 10s
volumes:
- './data/zitadel:/current-dir'
- './data/machinekey:/machinekey'
- './certs:/etc/ssl/certs:ro'
networks:
- proxy
- zitadel
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.zitadel-api.rule=Host(zitadel.customdomain.com) && !PathPrefix(/ui/v2/login)"
- "traefik.http.routers.zitadel-api.entrypoints=websecure"
- "traefik.http.routers.zitadel-api.tls=true"
- "traefik.http.routers.zitadel-api.priority=10"
- "traefik.http.routers.zitadel-api.service=zitadel-api-svc"
- "traefik.http.services.zitadel-api-svc.loadbalancer.server.port=8080"
- "traefik.http.services.zitadel-api-svc.loadbalancer.server.scheme=h2c"
- "traefik.http.services.zitadel-api-svc.loadbalancer.passHostHeader=true"
- "traefik.http.routers.zitadel-login.rule=Host(zitadel.customdomain.com) && PathPrefix(/ui/v2/login)"
- "traefik.http.routers.zitadel-login.entrypoints=websecure"
- "traefik.http.routers.zitadel-login.tls=true"
- "traefik.http.routers.zitadel-login.priority=20"
- "traefik.http.routers.zitadel-login.service=zitadel-login-svc"
- "traefik.http.services.zitadel-login-svc.loadbalancer.server.port=3000"
- "traefik.http.services.zitadel-login-svc.loadbalancer.server.scheme=http"
- "traefik.http.services.zitadel-login-svc.loadbalancer.passHostHeader=true"
depends_on:
db:
condition: service_healthy
login:
image: 'ghcr.io/zitadel/zitadel-login:latest'
container_name: zitadel_login
restart: unless-stopped
network_mode: 'service:zitadel'
environment:
- 'ZITADEL_API_URL=http://127.0.0.1:8080'
- 'HOSTNAME=0.0.0.0'
- NEXT_PUBLIC_BASE_PATH=/ui/v2/login
- ZITADEL_SERVICE_USER_TOKEN_FILE=/current-dir/login-client.pat
- 'CUSTOM_REQUEST_HEADERS=X-Forwarded-Host:zitadel.customdomain.com,X-Zitadel-Public-Host:zitadel.customdomain.com,X-Forwarded-Proto:https'
- SSL_CERT_FILE=/etc/ssl/certs/combinedCerts.crt
user: '0:0'
volumes:
- './data/zitadel:/current-dir:ro'
- './certs:/etc/ssl/certs:ro'
depends_on:
zitadel:
condition: service_healthy
restart: false
networks:
proxy:
external: true
zitadel:
internal: true
traefik.yml :
log: level: INFO
api: dashboard: false
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
permanent: true
websecure:
address: ":443"
http2:
maxConcurrentStreams: 250
forwardedHeaders:
insecure: true
providers:
docker:
exposedByDefault: false
network: proxy
file:
filename: /etc/traefik/dynamic.yml
watch: true
dynamic.yml:
tls: stores: default: defaultCertificate: certFile: /etc/traefik/certs/zitadel.cer keyFile: /etc/traefik/certs/zitadel.key certificates: - certFile: /etc/traefik/certs/zitadel.cer keyFile: /etc/traefik/certs/zitadel.key http: serversTransports: zitadel: insecureSkipVerify: true login: insecureSkipVerify: true
Additional Context
In my scenario, all the services including zitadel are in our local network without access from public internet and we use our own PKI build on microsoft certification center with our custom CA. That is why I have to mount combinedCerts.crt so Zitadel would trust Active Directory when starting LDAP flow.
EDIT: Almost forgot to attach logs: Here is the entries I see as result of docker compsoe logs command when reproducing the issue
zitadel | time="2026-06-23T09:33:34Z" level=error msg="unable to set instance" caller="/home/runner/work/zitadel/zitadel/internal/api/grpc/server/connect_middleware/instance_interceptor.go:100" error="unable to get instance by domain: instanceDomain localhost, publicHostname zitadel.customdomain.com: ID=QUERY-1kIjX Message=Errors.Instance.NotFound" externalDomain=zitadel.customdomain.com origin="https://zitadel.customdomain.com" zitadel | time=2026-06-23T09:33:34.613Z level=INFO msg="request served" request.id=d8t55rg1pfrs739kkt20 request.instance_host=localhost:3000 request.public_host=zitadel.customdomain.com TraceID=626a9ea7fe4815b87d745127dcc6b681 SpanID=a10d72a860e64af0 stream=request version=v4.15.1 protocol=connect service=zitadel.settings.v2.SettingsService http_method=POST path=/zitadel.settings.v2.SettingsService/GetGeneralSettings code=not_found duration=898.926µs zitadel | time="2026-06-23T09:33:34Z" level=error msg="unable to set instance" caller="/home/runner/work/zitadel/zitadel/internal/api/grpc/server/connect_middleware/instance_interceptor.go:100" error="unable to get instance by domain: instanceDomain localhost, publicHostname zitadel.customdomain.com, zitadel.customdomain.com: ID=QUERY-1kIjX Message=Errors.Instance.NotFound" externalDomain=zitadel.customdomain.com origin="https://zitadel.customdomain.com, zitadel.customdomain.com" zitadel | time=2026-06-23T09:33:34.613Z level=INFO msg="request served" request.id=d8t55rg1pfrs739kkt1g request.instance_host=localhost:3000 request.public_host="zitadel.customdomain.com, zitadel.customdomain.com" TraceID=db7a1a22bbdfde0ca98888131dc633c4 SpanID=136e890f4da3efc3 stream=request version=v4.15.1 protocol=connect service=zitadel.settings.v2.SettingsService http_method=POST path=/zitadel.settings.v2.SettingsService/GetSecuritySettings code=not_found duration=1.072729ms zitadel | time="2026-06-23T09:33:34Z" level=error msg="unable to set instance" caller="/home/runner/work/zitadel/zitadel/internal/api/grpc/server/connect_middleware/instance_interceptor.go:100" error="unable to get instance by domain: instanceDomain localhost, publicHostname zitadel.customdomain.com: ID=QUERY-1kIjX Message=Errors.Instance.NotFound" externalDomain=zitadel.customdomain.com origin="https://zitadel.customdomain.com" zitadel | time=2026-06-23T09:33:34.614Z level=INFO msg="request served" request.id=d8t55rg1pfrs739kkt2g request.instance_host=localhost:3000 request.public_host=zitadel.customdomain.com TraceID=85596cf4777f3b51de35b91db59ccfb2 SpanID=c6fe968fb56a0262 stream=request version=v4.15.1 protocol=connect service=zitadel.org.v2.OrganizationService http_method=POST path=/zitadel.org.v2.OrganizationService/ListOrganizations code=not_found duration=1.963913ms zitadel_login | Failed to load supported languages Error: fetch() returned undefined zitadel_login | at #X (.next/server/chunks/ssr/0uqqxk7..js:10:49910) zitadel_login | at async C (.next/server/chunks/ssr/[root-of-the-server]_0ywl6c~..js:1:21357) zitadel_login | Failed to load global settings Error: fetch() returned undefined zitadel_login | at #X (.next/server/chunks/ssr/0uqqxk7..js:10:49910) zitadel_login | at async m (.next/server/chunks/ssr/0uqqxk7..js:10:97288) zitadel_login | at async (.next/server/chunks/ssr/0uqqxk7..js:10:100177) zitadel_login | at async (.next/server/chunks/ssr/0uqqxk7..js:10:100444) zitadel_login | at async (.next/server/chunks/ssr/0uqqxk7..js:3:291833) zitadel_login | at async Module.B [as generateMetadata] (.next/server/chunks/ssr/[root-of-the-server]_0ywl6c~..js:1:21185) zitadel | time="2026-06-23T09:33:34Z" level=error msg="unable to set instance" caller="/home/runner/work/zitadel/zitadel/internal/api/grpc/server/connect_middleware/instance_interceptor.go:100" error="unable to get instance by domain: instanceDomain localhost, publicHostname zitadel.customdomain.com: ID=QUERY-1kIjX Message=Errors.Instance.NotFound" externalDomain=zitadel.customdomain.com origin="https://zitadel.customdomain.com" zitadel | time=2026-06-23T09:33:34.618Z level=INFO msg="request served" request.id=d8t55rg1pfrs739kkt30 request.instance_host=localhost:3000 request.public_host=zitadel.customdomain.com TraceID=cefaeef06afc0701c1f3a8d493b051a2 SpanID=af3ca34efc90439c stream=request version=v4.15.1 protocol=connect service=zitadel.settings.v2.SettingsService http_method=POST path=/zitadel.settings.v2.SettingsService/GetHostedLoginTranslation code=not_found duration=702.271µs zitadel_login | {"context":"security-settings","level":"error","message":"Failed to fetch security settings from API","service":"zitadel-login","span_id":"c78b91a6e4eaa087","status":404,"statusText":"Not Found","timestamp":"2026-06-23T09:33:34.618Z","trace_flags":"01","trace_id":"1ce9768d56a1700c05021e9ecae16d32"} zitadel_login | Error fetching custom translations: Error: fetch() returned undefined zitadel_login | at #X (.next/server/chunks/ssr/0uqqxk7..js:10:49910) zitadel_login | at async m (.next/server/chunks/ssr/0uqqxk7..js:10:97820) zitadel_login | at async (.next/server/chunks/ssr/0uqqxk7..js:10:100177) zitadel_login | at async (.next/server/chunks/ssr/0uqqxk7..js:10:100444) zitadel_login | ⨯ Error: fetch() returned undefined zitadel_login | at #X (.next/server/chunks/ssr/0uqqxk7..js:10:49910) zitadel_login | at async i (.next/server/chunks/ssr/[root-of-the-server]_0-5kuos..js:1:4166) { zitadel_login | digest: '1854523408' zitadel_login | }
You may assume that it is Instance not found error from troubleshooting guide, however, fixes listed there does not work for me.
Source: zitadel/zitadel