Hi , when migrating from Prefect1 to Prefect2 I en...
# prefect-cloud
j
Hi , when migrating from Prefect1 to Prefect2 I encountered a problem. The local agent always failed with following error msg:
Copy code
___ ___ ___ ___ ___ ___ _____     _   ___ ___ _  _ _____
 | _ \ _ \ __| __| __/ __|_   _|   /_\ / __| __| \| |_   _|
 |  _/   / _|| _|| _| (__  | |    / _ \ (_ | _|| .` | | |
 |_| |_|_\___|_| |___\___| |_|   /_/ \_\___|___|_|\_| |_|


Agent started! Looking for work from work pool 'default-agent-pool'...

Failed the last 3 attempts.  Please check your environment and configuration.
Examples of recent errors:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/h2/connection.py", line 224, in
process_input
    func, target_state = self._transitions[(self.state, input_)]
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.SEND_HEADERS: 0>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/http2.py", line
116, in handle_async_request
    await self._send_request_headers(request=request, stream_id=stream_id)
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/http2.py", line
213, in _send_request_headers
    self._h2_state.send_headers(stream_id, headers, end_stream=end_stream)
  File "/usr/local/lib/python3.10/dist-packages/h2/connection.py", line 766, in
send_headers
    self.state_machine.process_input(ConnectionInputs.SEND_HEADERS)
  File "/usr/local/lib/python3.10/dist-packages/h2/connection.py", line 228, in
process_input
    raise ProtocolError(
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.SEND_HEADERS in
state ConnectionState.CLOSED
r
have you got the correct PREFECT_API_URL env var?
j
PREFECT_API_URL was generated by prefect CLI:
Copy code
prefect cloud login -k xxxxxxxxxxx_some_key
and PREFECT_API_URL can be found in :
Copy code
~/.prefect/profiles.toml
something like:
Copy code
PREFECT_API_URL = "<https://api.prefect.cloud/api/accounts/a36e19a0-222d-4a86-814e-7919bcfdd2/workspaces/aa3307b6-9d0d-4ee9-ac68-dd576aa0b2d>
Is it correct?
r
also make sure you have the token
j
Yes, I think it should be okay because the 1st one or two small flows can be executed successfully.