https://prefect.io logo
a

Avi

07/04/2023, 3:16 PM
I followed the instruction to install k8s prefect-worker chart from here, Got 2 failures: 1. limit can not be None - as it is set be default for some reason (updated it by adding limit: 5 to the config section) 2. Got the API Key issue as many others got:
Copy code
Worker 'KubernetesWorker 0c71c16f-d861-467d-b6fc-761b01a5ea66' started!
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 255, in coroutine_wrapper
    return call()
           ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 383, in __call__
    return self.result()
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 283, in result
    return self.future.result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 169, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 346, in _run_async
    result = await coro
             ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/worker.py", line 129, in start
    await worker.sync_with_backend()
  File "/usr/local/lib/python3.11/site-packages/prefect/workers/base.py", line 690, in sync_with_backend
    await self._update_local_work_pool_info()
  File "/usr/local/lib/python3.11/site-packages/prefect/workers/base.py", line 647, in _update_local_work_pool_info
    work_pool = await self._client.read_work_pool(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/client/orchestration.py", line 2183, in read_work_pool
    response = await self._client.get(f"/work_pools/{work_pool_name}")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/client/base.py", line 280, in send
    response.raise_for_status()
  File "/usr/local/lib/python3.11/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 '403 Forbidden' for url '<https://api.prefect.cloud/api/accounts/24dda59a-eee1-4d84-8c71-075633a3a0f3/workspaces/2fecb2ed-8785-4c2e-a324-84c4283cb332/work_pools/default-agent-pool>'
Response: {'detail': 'Unauthorized'}
For more information check: <https://httpstatuses.com/403>
An exception occurred.
Checked the health of my key by this and I see
{"detail":"Not authenticated"}
Not sure where to go from here???
c

Christopher Boyd

07/05/2023, 2:12 PM
Hi Avi, - https://discourse.prefect.io/t/how-can-i-tell-if-there-is-an-issue-with-my-api-key/2185 403 means you have a good key, that is quite literally not permitted to that workspace
If you are already authenticated through the CLI locally, you can run
prefect profile inspect
to verify what is being used. I would double check that the API key you are using is valid for the account + workspace you are trying to use it with. An example of where this could be problematic is if you have two workspaces, and are using an api key for one workspace, that was created for another