Skip to content

Querying for group members sometimes fails #3907

@rocketeerbkw

Description

@rocketeerbkw

Describe the bug

Sometimes querying the API to list group members will throw an error:

{
  "errors": [
    {
      "message": "keycloakUsers is not iterable",

To Reproduce

Steps to reproduce the behavior:

  1. Create a group with no members

  2. Run the query:

    query groupByName {
      groupByName(name:"memberless-group"){
        id
        name
        memberCount
        members {
          user {
            email
          }
          role
        }
      }
    }
    
  3. It should fail all the time

  4. Comment out either the memberCount OR members field, and the query no longer fails

    • Here's where it gets weird

The error also sometimes triggers right after adding a member to a group, then running the query in step 2, but it's difficult to reproduce.

There is some kind of race condition (?) where the call to keycloakAdminClient.groups.listMembers in services/api/src/models/groups.ts returns null instead of an empty array.

Expected behavior

Listing group members doesn't throw errors.

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