Client error '404 Not Found' when running trying to start a deployment from docker

So I’ve been following the tutorial here: Docker - Prefect Docs

However when I try to run the deployment, I get a httpx.HTTPStatusError: Client error '404 Not Found'

Deployment command:

prefect deployment build ./log_flow.py:log_flow -n log-flow-docker-tutorial -ib docker-container/log-tutorial -q test -o log-flow-docker-deployment.yaml -a

Log:

17:30:38.678 | INFO    | prefect.agent - Submitting flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221'
17:30:38.782 | INFO    | prefect.infrastructure.docker-container - Creating Docker container 'epsilon64-kanki'...
17:30:38.935 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'created'
17:30:39.418 | DEBUG   | prefect.agent - Checking for cancelled flow runs...
17:30:39.489 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'running'
17:30:39.494 | INFO    | prefect.agent - Completed submission of flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221'
/usr/local/lib/python3.10/runpy.py:126: RuntimeWarning: 'prefect.engine' found in sys.modules after import of package 'prefect', but prior to execution of 'prefect.engine'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
06:30:45.453 | DEBUG   | prefect.client - Using ephemeral application with database at sqlite+aiosqlite:////root/.prefect/orion.db
06:30:45.480 | ERROR   | prefect.engine - Engine execution of flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221' exited with unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/client/orion.py", line 1443, in read_flow_run
    response = await self._client.get(f"/flow_runs/{flow_run_id}")
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/base.py", line 251, in send
    response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 745, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://ephemeral-orion/api/flow_runs/ef1e3069-e611-4dda-ad54-11c0ba4af221'
For more information check: https://httpstatuses.com/404

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 1785, in <module>
    enter_flow_run_engine_from_subprocess(flow_run_id)
  File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 186, in enter_flow_run_engine_from_subprocess
    return anyio.run(retrieve_flow_then_begin_flow_run, flow_run_id)
  File "/usr/local/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 47, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 258, in retrieve_flow_then_begin_flow_run
    flow_run = await client.read_flow_run(flow_run_id)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/orion.py", line 1446, in read_flow_run
    raise prefect.exceptions.ObjectNotFound(http_exc=e) from e
prefect.exceptions.ObjectNotFound
17:30:46.182 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'exited'
17:30:46.183 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'exited'
17:30:46.201 | INFO    | prefect.agent - Reported flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221' as crashed: Flow run infrastructure exited with non-zero status code 1.

I dont think it’s a problem with my code, and everything else is pretty basic. The deployment also works if I exclude the docker block from the deployment command (no --ib docker-container/log-tutorial). Why is this happening?

looks like the flow run was deleted

I would need a full reproducible example - can you perhaps build a full small repo with all files and share it? we could try to reproduce then

Here’s my repo: GitHub - Wingmore/prefect-docker-tutorial: Prefect docker tutorial

If it’s any help, my environment details are
conda 4.11.0
prefect 2.7.0
Python 3.10.8

thanks so much - did you set your Prefect Cloud API key? this would explain 404

I think the issue is that you are using a recipe for Prefect Cloud and you try to run it for OSS with ephemeral API: httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://ephemeral-orion/api/flow_runs/ef1e3069-e611-4dda-ad54-11c0ba4af221'

for OSS, I’d recommend following this setup:

https://discourse.prefect.io/t/running-prefect-2-with-docker-compose/1516

No, I was using Prefect Orion the whole time using prefect orion start… Are there instructions on how to set up this key?

Also what is OSS?

OSS means open source, sorry

API key can be created when you sign up for prefect cloud, check our documentation in section Cloud docs.prefect.io