Prefect-worker pod fails with error - 405 Method Not Allowed

We are hosting prefect2 using helm charts on AKS. However the worker pod fails due to the below error

  File "/usr/local/lib/python3.11/site-packages/prefect/client/base.py", line 275, in send
    response.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/prefect/client/base.py", line 135, in raise_for_status
    raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
prefect.exceptions.PrefectHTTPStatusError: Client error '405 Method Not Allowed' for url 'https://prefect2-url/api/work_pools/'
Response: {'detail': 'Method Not Allowed'}
For more information check: https://httpstatuses.com/405
An exception occurred.

We have only updated the below config in the values.yaml:

  apiConfig: "server"

  cloudApiConfig:
    # -- prefect account ID
    accountId: ""
    # -- prefect workspace ID
    workspaceId: ""

    apiKeySecret:
      # -- prefect API secret name
      name: prefect-api-key
      # -- prefect API secret key
      key: key

    # -- prefect cloud API url; the full URL is constructed as https://cloudUrl/accounts/accountId/workspaces/workspaceId
    cloudUrl: https://api.prefect.cloud/api

  serverApiConfig:
    # -- prefect API url (PREFECT_API_URL); should be in-cluster URL if the agent is deployed in the same cluster as the API
    apiUrl: https://prefect2-url/api

Did you fix this error?

I am also having the same issue when deployed using Helm and setting the API config type to “server”

Hi @dasarpmar,

Could you check that your API URL is correct?

This is my apiurl:

  apiConfig: "server"
  serverApiConfig:
    # -- prefect API url (PREFECT_API_URL); should be in-cluster URL if the worker is deployed in the same cluster as the API
    apiUrl: http://11.2.26.220:4200/api
1 Like

Apparently, setting worker.config.workPool and doing helm upgrade fixed the issue for me :pray: