hi all! running prefect server and agent (and db) in a docker. Getting the following message from th...
a
hi all! running prefect server and agent (and db) in a docker. Getting the following message from the agent:
Copy code
prefect-agent-1     | line 77, in map_httpcore_exceptions
prefect-agent-1     |     raise mapped_exc(message) from exc
prefect-agent-1     | httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' 
prefect-agent-1     | protocol.
Has anyone seen something similar? (full error message in the thread)
j
Hi @Alexander Belikov - would you mind moving the error message into the thread here? Keeping posts short helps us scan through the channel and answer questions more easily.
Your error message suggests that the Prefect agent is encountering an issue related to the request URL. Specifically, it mentions that the request URL is missing an '<http://'|http://'> or '<https://'|https://'> protocol. This error commonly occurs when the URL provided for the Prefect server or other external resources is not properly formatted with the required protocol prefix. To resolve this issue, ensure that you have correctly specified the URL in the configuration for the Prefect agent. Make sure it includes the appropriate protocol prefix, such as '<http://'|http://'> or '<https://'|https://'>. For example, if the URL for your Prefect server is
<http://example.com|example.com>
, update it to `http://example.com` or `https://example.com`, depending on the protocol you are using. Double-check your configuration and ensure that the URL is properly formatted with the correct protocol prefix.
a
full error message :
Copy code
prefect-agent-1     | Failed the last 3 attempts. Please check your environment and configuration.
prefect-agent-1     | Examples of recent errors:
prefect-agent-1     | 
prefect-agent-1     | Traceback (most recent call last):
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", 
prefect-agent-1     | line 60, in map_httpcore_exceptions
prefect-agent-1     |     yield
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", 
prefect-agent-1     | line 353, in handle_async_request
prefect-agent-1     |     resp = await self._pool.handle_async_request(req)
prefect-agent-1     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File 
prefect-agent-1     | "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", 
prefect-agent-1     | line 208, in handle_async_request
prefect-agent-1     |     raise UnsupportedProtocol(
prefect-agent-1     | httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' 
prefect-agent-1     | protocol.
prefect-agent-1     | 
prefect-agent-1     | The above exception was the direct cause of the following exception:
prefect-agent-1     | 
prefect-agent-1     | Traceback (most recent call last):
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/prefect/utilities/services.py", 
prefect-agent-1     | line 53, in critical_service_loop
prefect-agent-1     |     await workload()
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/prefect/agent.py", line 264, in 
prefect-agent-1     | check_for_cancelled_flow_runs
prefect-agent-1     |     named_cancelling_flow_runs = await self.client.read_flow_runs(
prefect-agent-1     |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File 
prefect-agent-1     | "/usr/local/lib/python3.11/site-packages/prefect/client/orchestration.py", line 
prefect-agent-1     | 1700, in read_flow_runs
prefect-agent-1     |     response = await <http://self._client.post|self._client.post>("/flow_runs/filter", json=body)
prefect-agent-1     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1845, in
prefect-agent-1     | post
prefect-agent-1     |     return await self.request(
prefect-agent-1     |            ^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in
prefect-agent-1     | request
prefect-agent-1     |     return await self.send(request, auth=auth, 
prefect-agent-1     | follow_redirects=follow_redirects)
prefect-agent-1     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     | ^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/prefect/client/base.py", line 
prefect-agent-1     | 251, in send
prefect-agent-1     |     response = await self._send_with_retry(
prefect-agent-1     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/prefect/client/base.py", line 
prefect-agent-1     | 194, in _send_with_retry
prefect-agent-1     |     response = await request()
prefect-agent-1     |                ^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1617, in
prefect-agent-1     | send
prefect-agent-1     |     response = await self._send_handling_auth(
prefect-agent-1     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1645, in
prefect-agent-1     | _send_handling_auth
prefect-agent-1     |     response = await self._send_handling_redirects(
prefect-agent-1     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1682, in
prefect-agent-1     | _send_handling_redirects
prefect-agent-1     |     response = await self._send_single_request(request)
prefect-agent-1     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1719, in
prefect-agent-1     | _send_single_request
prefect-agent-1     |     response = await transport.handle_async_request(request)
prefect-agent-1     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", 
prefect-agent-1     | line 352, in handle_async_request
prefect-agent-1     |     with map_httpcore_exceptions():
prefect-agent-1     |   File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
prefect-agent-1     |     self.gen.throw(typ, value, traceback)
prefect-agent-1     |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", 
prefect-agent-1     | line 77, in map_httpcore_exceptions
prefect-agent-1     |     raise mapped_exc(message) from exc
prefect-agent-1     | httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' 
prefect-agent-1     | protocol.
prefect-agent-1     | 
prefect-agent-1     | 
prefect-agent-1     | Backing off due to consecutive errors, using increased interval of  60.0s.
thank you @Jenny, for the interpretation of the error message, this what I understood as well. I double-checked the url the agent is receiving before posting, it does contains a
http
prefix
ok, problem solved: indeed the error spoke for itself. In my docker-compose I used double quotes when using env var substitution :
Copy code
environment:
      - PREFECT_API_URL="${HOST_URL}:${PREFECT_PORT}/api"
but in fact the double quotes were the cause of the problem
j
Great to hear! And thanks for coming back with an update.