I am running prefect flows inside docker containers on an EC2 instance with prefect version = 2.10.8. A deployment was built that contains a docker block and a bitbucket block. These flows have been running successfully in the EC2 for weeks until yesterday morning on Jan. 16, 2024 after 6:00AM. Nothing was changed in the EC2, the blocks or the prefect flow code. I am encountering the following error:
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/prefect/engine.py", line 276, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/usr/local/lib/python3.9/site-packages/prefect/client/utilities.py", line 40, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/prefect/deployments.py", line 192, in load_flow_from_flow_run
storage_block = Block._from_block_document(storage_document)
File "/usr/local/lib/python3.9/site-packages/prefect/blocks/core.py", line 618, in _from_block_document
else cls.get_block_class_from_schema(block_document.block_schema)
File "/usr/local/lib/python3.9/site-packages/prefect/blocks/core.py", line 672, in get_block_class_from_schema
return lookup_type(cls, block_schema_to_key(schema))
File "/usr/local/lib/python3.9/site-packages/prefect/utilities/dispatch.py", line 185, in lookup_type
raise KeyError(
KeyError: "No class found for dispatch key 'bitbucket-repository' in registry for type 'Block'."
I ran the following commands locally a few weeks ago with success:
Pip install prefect-bitbucket
Prefect register block -m prefect_bitbucket
and the Dockerfile image that was creating the containers that was also working until then is the following:
FROM prefecthq/prefect:2.10.8-python3.9
RUN apt-get update && apt-get install -y sudo
RUN sudo apt-get install -y python3-dev default-libmysqlclient-dev build-essential
ENV TZ="America/Denver"
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN pip install --force-reinstall 'sqlalchemy < 2.0.0'.
I do not know what changed and I tried to explicitly fix the dependency versions in the Dockerfile but I always get the same error: KeyError: "No class found for dispatch key 'bitbucket-repository' in registry for type 'Block'."
Any thoughts or ideas on what I need to do to fix this error? Thanks!