Hi folks - I am running into API errors trying to ...
# prefect-community
m
Hi folks - I am running into API errors trying to poll the status of a flow run - seems like a Cloud API issue - anyone else facing similar issues ?
Copy code
status = client.get_flow_run_info(flow_run_id)
  File "~/.pyenv/versions/3.7.7/envs/etl/lib/python3.7/site-packages/prefect/client/client.py", line 990, in get_flow_run_info
    result = self.graphql(query).data.flow_run_by_pk  # type: ignore
  File "~/.pyenv/versions/3.7.7/envs/etl/lib/python3.7/site-packages/prefect/client/client.py", line 281, in graphql
    retry_on_api_error=retry_on_api_error,
  File "~/.pyenv/versions/3.7.7/envs/etl/lib/python3.7/site-packages/prefect/client/client.py", line 237, in post
    retry_on_api_error=retry_on_api_error,
  File "~/.pyenv/versions/3.7.7/envs/etl/lib/python3.7/site-packages/prefect/client/client.py", line 373, in _request
    token = self.get_auth_token()
  File "~/.pyenv/versions/3.7.7/envs/etl/lib/python3.7/site-packages/prefect/client/client.py", line 503, in get_auth_token
    self._refresh_access_token()
  File "~/.pyenv/versions/3.7.7/envs/etl/lib/python3.7/site-packages/prefect/client/client.py", line 630, in _refresh_access_token
    token=self._refresh_token,
  File "~/.pyenv/versions/3.7.7/envs/etl/lib/python3.7/site-packages/prefect/client/client.py", line 294, in graphql
    raise ClientError(result["errors"])
prefect.utilities.exceptions.ClientError: [{'path': ['refresh_token'], 'message': 'Unable to complete operation', 'extensions': {'code': 'API_ERROR'}}]
I am calling
status = client.get_flow_run_info(flow_run_id)
j
Hi @Marwan Sarieddine - that looks like the API needed to refresh your access token but wasn't able to. Can you double check that your API tokens are up to date?
m
Hi @Jenny - thank you for your prompt response. you are right - I just called
prefect auth login $USER_TOKEN
and I am logged in again and the API call seems to be working again - how long does the login usually last before I have to call it again ? and should I be using a TENANT_TOKEN instead if I want to keep the session open for longer.
@Jenny - I just face this issue again - even though I had only called
prefect auth login $USER_TOKEN
22 minutes ago the
USER_TOKEN
was generated yesterday - and I am running prefect v0.13.3