updateUsersPermissionsUser mutation is using the Id and not the documentId

System Information
  • Strapi Version: 5.6
  • Operating System: Windows 11
  • Database: Mysql
  • Node Version: 21.7.3
  • NPM Version: 10.5.0
  • Yarn Version:

Hello everyone, I am currently struggling with the update of users via the GraphQL intefarce and the new documentIDs

I have a collection type Diet, I want my users to have some diet, so I have defined a relational field (user has many diet). And I want to users be able to modify these diets.

My problem is when I try to perform the graphql mutation :

mutation UpdateUsersPermissionsUser($updateUsersPermissionsUserId: ID!, $data: UsersPermissionsUserInput!) {
  updateUsersPermissionsUser(id: $updateUsersPermissionsUserId, data: $data) {
    data {
      documentId
    }
  }
}

with these variables:

{  
  "updateUsersPermissionsUserId": "g1694o33xzjghhz9obw0brhy",
  "data": {
    "diets": ["k5y839zqg5rk33c1r4afrfws"]
  }
}

I get this error :

{
  "errors": [
    {
      "message": "Internal Server Error",
      "extensions": {
        "error": {
          "name": "NotFoundError",
          "message": "User not found",
          "details": {}
        },
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ],
  "data": null
}

But when I perform whith regular ids like :

{  
  "updateUsersPermissionsUserId": "3",
  "data": {
    "diets": ["8"]
  }
}

It works.

I guess this is a userPermission plugin bug which is only able to use id, but since we cannot get ids via the graphQL interface this is pretty anoying.

Do you have any idea to solve this problem ?

Currently my workaround is to fetch diets with rest api to get id, compare this array with my inputs and send to the graphql the matched ids. Which is very odd because I have to perform an aditionnal request to rest api which is not the coding standard of the project

I have referenced the bug here : UserPermissionPlugin require id instead of documentId for mutations on relational fields · Issue #22799 · strapi/strapi · GitHub

Thanks.