Tinh
09/08/2025, 9:12 AMPrefect 3.2.6
and have currently problem deploying flow on ther server with error below
File "/home/vua/miniconda3/envs/cenv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 101, in handle_request
raise exc
File "/home/vua/miniconda3/envs/cenv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 78, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/vua/miniconda3/envs/cenv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 124, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vua/miniconda3/envs/cenv/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 208, in connect_tcp
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vua/miniconda3/envs/cenv/lib/python3.11/socket.py", line 848, in create_connection
sock.connect(sa)
What could I do ?Marvin
09/08/2025, 9:12 AMMarvin
09/08/2025, 9:16 AMPREFECT_API_URL
?
Run:
prefect config view --show-sources
Look for PREFECT_API_URL
and (if using Cloud) that you have a PREFECT_API_KEY
.
2) Test the health endpoint directly
- In Prefect 3.x the health endpoint is <PREFECT_API_URL>/health
.
- Example (self-hosted default): if PREFECT_API_URL=http://<server-host>:4200/api
, test:
curl -v http://<server-host>:4200/api/health
- Docs: Health check endpoint
If this does not return healthy (HTTP 200 / JSON), the issue is network/server-side rather than your deployment code.
3) If you are self-hosting Prefect Server
- Make sure the server is running and listening on a reachable interface:
prefect server start --host 0.0.0.0 --port 4200 --ui
- Ensure your client can reach that host/port (firewall/security group allows 4200, correct DNS/IP).
- Set your client to use that API URL:
prefect config set PREFECT_API_URL="http://<server-host>:4200/api"
- From the client, re-test:
curl -v $PREFECT_API_URL/health
4) If you are using Prefect Cloud
- Use the CLI to configure your profile (this sets PREFECT_API_URL
and uses your key):
prefect cloud login -k <YOUR_API_KEY> -w <account_handle>/<workspace_handle>
- Re-test:
curl -v $(prefect config view | grep PREFECT_API_URL | awk '{print $3}')/health
- Cloud connection guide: Connect to Cloud
5) Common environment gotchas
- Proxies: if behind a corporate proxy, ensure NO_PROXY
includes your Prefect host (e.g., NO_PROXY=localhost,127.0.0.1,<server-host>
). Otherwise, TCP may time out or be blocked.
- HTTPS/self-signed certs: if using HTTPS on your own server, ensure the certificate is trusted by the client OS or use a trusted reverse proxy in front of Prefect.
If the above checks don’t resolve it, could you share:
- Whether you’re targeting Cloud or self-hosted Server
- The exact value of PREFECT_API_URL
(you can redact host if needed)
- The exact command/code you’re using to deploy (e.g., prefect deploy
or flow.from_source(...).deploy(...)
)
- The complete error line after sock.connect(sa)
(e.g., “Connection refused”, “Timed out”, “Name or service not known”, etc.)
With that info I can pinpoint the fix quickly.