GiuxJua
07/10/2024, 12:55 PMprefect deployment build path-to-file/prefect_flows.py:simple_test --name simple_test_flow -sb github/my-cicd -t some_tags --apply
and I have an existing block on prefect cloud that can be easily accessed as follows
from prefect_github.repository import GitHubRepository
github_repository_block = GitHubRepository.load("my-cicd")
Why am i getting the following error: ValueError: Unable to find block document named my-cicd for block type github
?
Currently using the Prefect version: 2.19.7 - thanks š”Nate
07/10/2024, 7:01 PMprefect config view
show?GiuxJua
07/11/2024, 8:48 AMNate
07/11/2024, 4:17 PMprefect-github
? had you created a block named my-cicd
of that type?GiuxJua
07/12/2024, 11:16 AMprefect-github
library. If, instead, I use the deprecated way, everything works - it seems to me a bug.Nate
07/12/2024, 3:48 PMGiuxJua
07/12/2024, 4:07 PMTraceback (most recent call last):
File "/home/runner/.cache/virtualenvs/ENV/lib/python3.11/site-packages/prefect/blocks/core.py", line 743, in _get_block_document
block_document = await client.read_block_document_by_name(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/client/orchestration.py", line 1505, in read_block_document_by_name
raise prefect.exceptions.ObjectNotFound(http_exc=e) from e
prefect.exceptions.ObjectNotFound
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 259, in coroutine_wrapper
return call()
^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 432, in __call__
return self.result()
^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 318, in result
return self.future.result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 179, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 389, in _run_async
result = await coro
^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/cli/deployment.py", line 1555, in build
storage = await Block.load(storage_block)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/client/utilities.py", line 78, in with_injected_client
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/blocks/core.py", line 838, in load
block_document, block_document_name = await cls._get_block_document(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/client/utilities.py", line 78, in with_injected_client
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/ENV/lib/python3.11/site-packages/prefect/blocks/core.py", line 747, in _get_block_document
raise ValueError(
ValueError: Unable to find block document named my-cicd for block type github
An exception occurred.
The strange thing is that
from prefect_github.repository import GitHubRepository
github_repository_block = GitHubRepository.load("my-cicd")
works from a python shell. However, under the deployment it raises this issue (which is then solved using the old way, i.e. from prefect.filesystems import GitHub
Nate
07/12/2024, 6:11 PMprefect block ls | grep github-repository
you do have an entry for that specific block type? this
> ValueError: Unable to find block document named my-cicd for block type github
doesnt make sense to me if that is the caseGiuxJua
07/13/2024, 1:41 PMsha_code ā GitHub Repository ā my-cicd ā github-repository/my-cicd
so the block exists, and lives in the right project. I therefore cannot understand why that is not working. The strange thing is that using the prefect.flesysyem.GitHub
class works and this is something I cannot understand why. Any chance for a follow up? šGiuxJua
07/13/2024, 2:00 PMprefect deployment build ./$FILE_PATH:$FLOW_NAME \
--name $FLOW_DEPLOYMENT_NAME \
-sb $MY_CICD \
-t $FLOW_TAG \
--apply
and the error is shown by the github actions workflow. The deployment goes successfull when using the "old" GitHub Block. Thanks againNate
07/13/2024, 2:34 PMValueError: Unable to find block document named my-cicd for block type github
hmm i bet you're right and this is a bug around the block type slug. because github
should correspond to prefect.filesystem.Github
, not prefect_github.repository.GitHubRepository
can you please share the output of the following so I can look into this?
pip list | grep -E 'prefect|github'