Lester Cayabyab
02/12/2026, 10:31 PMException: Unable to authenticate to the event stream. Please ensure the provided auth_token you are using is valid for this environment. workpool connection issue with prefect serverMarvin
02/12/2026, 10:31 PMMarvin
02/12/2026, 10:33 PMPREFECT_SERVER_API_AUTH_STRING (e.g., admin:pass)? If yes, the worker must use the same value via PREFECT_API_AUTH_STRING.
2) On the worker:
- Point to your server API (must include /api)
- Provide the matching auth string
- Make sure you’re not setting a PREFECT_API_KEY (that’s only for Prefect Cloud)
Example worker env:
export PREFECT_API_URL="http://<your-server-host>:4200/api"
export PREFECT_API_AUTH_STRING="admin:pass" # must match server's PREFECT_SERVER_API_AUTH_STRING
unset PREFECT_API_KEY # ensure Cloud key is not set
prefect worker start --pool <your-work-pool>
If you’re behind a reverse proxy (nginx, etc.), ensure WebSocket upgrades are allowed and headers aren’t stripped:
- Forward `Upgrade`/`Connection` headers
- Preserve WebSocket subprotocols (Prefect uses one during handshake)
Debugging tips:
- Enable verbose logs: export PREFECT_DEBUG_MODE=1 and retry the worker
- Verify server health: curl -I http://<your-server-host>:4200/api/health
- Confirm env on each side:
- Server: echo $PREFECT_SERVER_API_AUTH_STRING
- Worker: echo $PREFECT_API_URL and echo $PREFECT_API_AUTH_STRING
If this doesn’t resolve it, can you share:
- prefect version
- How you start the server (and whether PREFECT_SERVER_API_AUTH_STRING is set)
- The PREFECT_API_URL you’re using on the worker
- Any reverse proxy in front of the server
Helpful docs:
- Prefect settings
- Work pools and workers
- Self‑hosting Prefect ServerLester Cayabyab
02/12/2026, 11:16 PMprefect:3.4.6-python3.12 requiring auth in the the schema server