prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found'

I am dockerizing a prefect agent and try to deploy it on a server (hosted on Heroku) in order to be able to continuously send flows in the respectively defined deployments to the dedicated work queue.

The command that I use as an entry point in the Dockerfile is:
prefect work-queue create 'dev'

However, what I find is that I receive a 404 when providing proper ACCOUNT_ID and WORKSPACE_ID creds that assemble the PREFECT_API_URL:

Log of the Heroku deployed Prefect Agent

2022-09-15T20:27:17.724223+00:00 app[web.1]: prefect.exceptions.PrefectHTTPStatusError: Client error ‘404 Not Found’ for url ‘Prefect Cloud 2.0[… ACCOUNT_ID …]/workspace/[ … WORKSPACE_ID … ]/work_queues/’

Opening the URL in a browser results again in a 404. Replacing work_queues with work-queues results in a response.

Is it possible that the following line needs updating given prefect 2.0?

L.835 in prefect/client.py at main · PrefectHQ/prefect · GitHub [branch: main]

 try:
            response = await self._client.post("/work_queues/", json=data)

prefect version used:
2.4.0

Dockerfile:
https://github.com/sthenkel23/weisshorn-marine-flow/blob/3-fr-dockerize-deployments-1/Dockerfile

Hi Steffen,

It looks like you might be using the web app URL instead of the API URL. The API URL should look like: https://api.prefect.cloud/api/accounts/[ACCOUNT ID]/workspaces/[WORKSPACE ID]

1 Like

Apologies but I resolved it. The problem was the authentication within the defined Dockerfile. Adding:
RUN prefect config set PREFECT_API_URL=“$PREFECT_API_URL”
RUN prefect config set PREFECT_API_KEY=“$PREFECT_API_KEY”

Did the trick to accept the api.prefect.cloud… instead of app.prefect.cloud… URL.

1 Like