[BUG] There seems to be a problem with gitlab-cred...
# ask-community
c
[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/core.py", line 124, in run_steps
    step_output = await run_step(step, upstream_outputs)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/steps/core.py", line 95, in run_step
    result = await from_async.call_soon_in_new_thread(
  File "/media/hdd/vscode/prefect/src/prefect/_internal/concurrency/calls.py", line 291, in aresult
    return await asyncio.wrap_future(self.future)
  File "/media/hdd/vscode/prefect/src/prefect/_internal/concurrency/calls.py", line 315, in _run_sync
    result = self.fn(*self.args, **self.kwargs)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/steps/pull.py", line 196, in git_clone
    url_components = urllib.parse.urlparse(repository)
  File "/usr/lib/python3.10/urllib/parse.py", line 399, in urlparse
    url, scheme, _coerce_result = _coerce_args(url, scheme)
  File "/usr/lib/python3.10/urllib/parse.py", line 136, in _coerce_args
    return _decode_args(args) + (_encode_result,)
  File "/usr/lib/python3.10/urllib/parse.py", line 120, in _decode_args
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
  File "/usr/lib/python3.10/urllib/parse.py", 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/engine.py", 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/utilities.py", line 51, in with_injected_client
    return await fn(*args, **kwargs)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/deployments.py", line 217, in load_flow_from_flow_run
    output = await run_steps(deployment.pull_steps)
  File "/media/hdd/vscode/prefect/src/prefect/deployments/steps/core.py", 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
pull:
  - 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
deployments:
  - name: git-hello-world
    version: null
    tags: []
    description: null
    schedule: {}
    flow_name: null
    entrypoint: test.py:hello_world
    parameters: {}
    work_pool:
      name: test
      work_queue_name: null
      job_variables: {}
And here is the flow file:
Copy code
from prefect import flow, get_run_logger

@flow
def hello_world():
  logger = get_run_logger()
  <http://logger.info|logger.info>("TESTING GIT STUFF")
  return "Hello World"

if __name__ == "__main__":
  hello_world()
1
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.
j
hi, can you try replacing:
Copy code
access_token: "{{ prefect.blocks.gitlab-credentials.git-cred-test }}"
with:
Copy code
credentials: "{{ prefect.blocks.gitlab-credentials.git-cred-test }}"
upvote 1
c
It worked
🙌 1