09/14/2023, 7:30 AM
[BUG] There seems to be a problem with gitlab-credentials on the new version (2.13). I have followed the scheme from this section of docs to make a deployment. All seemed well until I started the flow registered in the config. Here is the error:
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "/media/hdd/vscode/prefect/src/prefect/deployments/steps/", line 124, in run_steps
    step_output = await run_step(step, upstream_outputs)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/steps/", line 95, in run_step
    result = await from_async.call_soon_in_new_thread(
  File "/media/hdd/vscode/prefect/src/prefect/_internal/concurrency/", line 291, in aresult
    return await asyncio.wrap_future(self.future)
  File "/media/hdd/vscode/prefect/src/prefect/_internal/concurrency/", line 315, in _run_sync
    result = self.fn(*self.args, **self.kwargs)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/steps/", line 196, in git_clone
    url_components = urllib.parse.urlparse(repository)
  File "/usr/lib/python3.10/urllib/", line 399, in urlparse
    url, scheme, _coerce_result = _coerce_args(url, scheme)
  File "/usr/lib/python3.10/urllib/", line 136, in _coerce_args
    return _decode_args(args) + (_encode_result,)
  File "/usr/lib/python3.10/urllib/", line 120, in _decode_args
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
  File "/usr/lib/python3.10/urllib/", line 120, in <genexpr>
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
AttributeError: 'dict' object has no attribute 'decode'

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

Traceback (most recent call last):
  File "/media/hdd/vscode/prefect/src/prefect/", line 394, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
  File "/media/hdd/vscode/prefect/src/prefect/client/", line 51, in with_injected_client
    return await fn(*args, **kwargs)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/", line 217, in load_flow_from_flow_run
    output = await run_steps(deployment.pull_steps)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/steps/", line 152, in run_steps
    raise StepExecutionError(f"Encountered error while running {fqn}") from exc
prefect.deployments.steps.core.StepExecutionError: Encountered error while running prefect.deployments.steps.git_clone
It seems that there is a problem in the code, which prevents the dict from being destructured properly. Here is the deployment file:
Copy code
# Welcome to your prefect.yaml file! You can use this file for storing and managing
# configuration for deploying your flows. We recommend committing this file to source
# control along with your flow code.

# Generic metadata about this project
name: prefect-flows
prefect-version: 2.13.0

# build section allows you to manage and build docker images
build: null

# push section allows you to manage if and how this project is uploaded to remote locations
push: null

# pull section allows you to provide instructions for cloning this project in remote locations
  - prefect.deployments.steps.git_clone:
      repository: "{{ prefect.blocks.gitlab-repository.git-repo-test}}"
      branch: master
      access_token: "{{ prefect.blocks.gitlab-credentials.git-cred-test }}"

# the deployments section allows you to provide configuration for deploying flows
  - name: git-hello-world
    version: null
    tags: []
    description: null
    schedule: {}
    flow_name: null
    parameters: {}
      name: test
      work_queue_name: null
      job_variables: {}
And here is the flow file:
Copy code
from prefect import flow, get_run_logger

def hello_world():
  logger = get_run_logger()
  return "Hello World"

if __name__ == "__main__":
I forgot to mention a couple of things. The setup is being made with docker-compose locally. I have tried without blocks and everything worked well. The workers are configured as local subprocesses The prefect container is communicating with a postgres database and the config variable is set accordingly. The prefect cli command is configured to use the same database.

Jake Kaplan

09/14/2023, 2:05 PM
hi, can you try replacing:
Copy code
access_token: "{{ prefect.blocks.gitlab-credentials.git-cred-test }}"
Copy code
credentials: "{{ prefect.blocks.gitlab-credentials.git-cred-test }}"
upvote 1


09/14/2023, 2:07 PM
It worked
🙌 1