hi all, was going through the setup + was getting ...
# pacc-clearcover-june-12-2023
p
hi all, was going through the setup + was getting the below error when testing out the
flowtest.py
Copy code
Traceback (most recent call last):
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/client/orchestration.py", line 322, in api_healthcheck
    await self._client.get("/health")
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/client/base.py", line 280, in send
    response.raise_for_status()
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/client/base.py", line 138, in raise_for_status
    raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
prefect.exceptions.PrefectHTTPStatusError: Client error '401 Unauthorized' for url '<https://api.prefect.cloud/api/accounts/33773d38-ee00-4099-971a-e48a469e08a5/workspaces/dce563b9-ab83-49b5-843e-de6bf578d0fb/health>'
Response: {'detail': 'Invalid authentication credentials'}
For more information check: <https://httpstatuses.com/401>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "flow_test.py", line 10, in <module>
    test_flow()
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/flows.py", line 511, in __call__
    return enter_flow_run_engine_from_flow_call(
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/engine.py", line 208, in enter_flow_run_engine_from_flow_call
    retval = from_sync.wait_for_call_in_loop_thread(
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/_internal/concurrency/api.py", line 243, in wait_for_call_in_loop_thread
    return call.result()
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 283, in result
    return self.future.result(timeout=timeout)
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 169, in result
    return self.__get_result()
  File "/Users/preyna/.pyenv/versions/3.8.11/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 346, in _run_async
    result = await coro
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/client/utilities.py", line 40, in with_injected_client
    return await fn(*args, **kwargs)
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/engine.py", line 263, in create_then_begin_flow_run
    await check_api_reachable(client, "Cannot create flow run")
  File "/Users/preyna/prefect_training/prefect_training_venv/lib/python3.8/site-packages/prefect/engine.py", line 2329, in check_api_reachable
    raise RuntimeError(
RuntimeError: Cannot create flow run. Failed to reach API at <https://api.prefect.cloud/api/accounts/33773d38-ee00-4099-971a-e48a469e08a5/workspaces/dce563b9-ab83-49b5-843e-de6bf578d0fb/>.
1
I’ve confirmed I’ve got prefect version
2.10.13
is there some config I’ve missed setting up / an existing config I need to deactivate?
j
Looks like your active Prefect profile is set up to try to connect to a Prefect Cloud account. That’s okay, but you need to authenticate via the CLI with
prefect cloud login
. What I suggest you do for now is run
prefect profile create local
to create a new profile. Then run
prefect profile use local
to switch to that profile.
👍 1
p
ooo0o0o0o okay that makes sense, and that worked for me, thanks!
👍 1
🦜 1