Skip to content

AttributeError: 'NoneType' object has no attribute 'replace' when doing project.mergerequests.get #1425

Closed
@nicoleepp

Description

@nicoleepp

Description of the problem, including code/CLI snippet

Traceback (most recent call last):
--
File "/var/task/tagbotgitlab/tagbot.py", line 31, in handler
status, msg = 200, handle_event(json.loads(evt.get("body", "{}")))
File "/var/task/tagbotgitlab/tagbot.py", line 53, in handle_event
return handle_open(payload)
File "/var/task/tagbotgitlab/tagbot.py", line 68, in handle_open
mr = p.mergerequests.get(mr_id, lazy=True)
File "/var/task/gitlab/exceptions.py", line 279, in wrapped_f
return f(*args, **kwargs)
File "/var/task/gitlab/mixins.py", line 46, in get
id = utils.clean_str_id(id)
File "/var/task/gitlab/utils.py", line 51, in clean_str_id
return id.replace("/", "%2F").replace("#", "%23")
AttributeError: 'NoneType' object has no attribute 'replace'
STATUS : 500
ERROR : Runtime error

Expected Behavior

p.mergerequests.get(mr_id, lazy=True) should return an MR instead of throwing an error

Actual Behavior

AttributeError: 'NoneType' object has no attribute 'replace'

Specifications

  • python-gitlab version: 2.5.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 13.11.1-ee

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions