Cannot read properties of undefined (reading 'includes')

default discord avatar
generator101
2 months ago

I am trying to create a graphql to create a user and trying this in the playground:



mutation(
  $email: String!
  $password: String!
  $username: String!
) {
  createUser(
    data: {
      email: $email
      password: $password
      username: $username
    }
  )
  {
    id
    username
    email
  }
}


and pass variables:


{   "email": "email@email.com",   "password": "1234567",   "username": "username" }


but I get this error:



{
  "errors": [
    {
      "message": "Cannot read properties of undefined (reading 'includes')",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createUser"
      ],
      "extensions": {
        "name": "TypeError"
      }
    }
  ],
  "data": {
    "createUser": null
  }
}


what is causing this error and where can I start debugging?



it was because of a hook mistake

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.