Diff_refs empty after MR is created

Hi, since few days our CI automation which relies on gitlab.com events hook and API calls is experiencing issues with the merge_requests endpoint.

As soon as a MR is created, we receive an event from gitlab.com then our automation query the API to get more details about the MR via the api/v4/projects/<:repo:>/merge_requests/<:id:>. Then the automation expects to find the diff_refs object with relevant data.

However since few days the diff_refs attribute is reported as None by the python JSON decoder.

{…, ‘latest_build_finished_at’: None, ‘first_deployed_to_production_at’: None, ‘pipeline’: None, ‘head_pipeline’: None, ‘diff_refs’: None, ‘merge_error’: None, ‘first_contribution’: False, ‘user’: {‘can_merge’: True}}

We discovered that adding some delay after we received the “merge requested created event” (few seconds) then the diff_refs becomes an object with the expected base_sha, head_sha and start_sha attributes.

So my questions are:

  • did any changes happen on gitlab.com that added or increased the delay for the diff_refs attribute to be available and correctly set ?
  • should we expect a delay and update our automation to keep retry fetching the MR details via the API until the diff_refs attribute is available ?

Thanks for your help


I’m seeing the same issue where diff_refs comes back as nil or empty, even when it shouldn’t. I don’t know for sure when it started, but I went on vacation and it was present, and I came back and it was gone! It’s possible it’s a new bug that was released, since the documentation still makes it seem like those values should be present (Merge requests API | GitLab). If you and others agree it’s a new bug, please make an issue on GitLab.

Thanks for the input @emmasax4 I’ve opened an issue diff_refs empty after MR is created (#386562) · Issues · GitLab.org / GitLab · GitLab