Skip to content

GraphQL for mergeRequests returns empty array

Summary

Query mergeRequests(first: "1") via GraphQL returns empty array, even though there are merge requests.

Steps to reproduce

Use GraphiQL and run the following:

{
  project(fullPath: "nelbacha/random") {
    
    # this returns merge request
    mergeRequest(iid: "1") {
      id
      title
    }
    
    #this returns nothing
    mergeRequests(first: 1) {
      edges {
        node {
          id
        }
      } 
    }
    
  }
}

Example Project

https://gitlab.com/nelbacha/random/

What is the current bug behavior?

GraphQL returns empty array

What is the expected correct behavior?

GraphQL returns object with nodes for merge requests

Relevant logs and/or screenshots

GraphQL returns the following:

{
  "data": {
    "project": {
      "mergeRequest": {
        "id": "gid://gitlab/MergeRequest/40147436",
        "title": "modify README.md"
      },
      "mergeRequests": {
        "edges": []
      }
    }
  }
}

Output of checks

This bug happens on GitLab.com