1

I'm getting "Bad request" response with message "roleId must be a string" when running a mutation. I don't know why since the "roleId" field is optional.

Schema

input CustomerUpdateInput {
  name: String
  roleId: String
}

updateCustomer(customerId: String!, customer: CustomerUpdateInput!): Customer!

Mutation (ERROR)

mutation updateCustomer{
  updateCustomer(customerId:"62c6d6ba303c734ef44ea4ed",
                             customer: {name:"Pablo"}
                            ),
  {id, name }
}

Mutation (WITHOUT ERROR)

mutation updateCustomer{
  updateCustomer(customerId:"62c6d6ba303c734ef44ea4ed",
                             customer: {
                                   name:"Pablo",
                                   roleId:"62c6d64f303c734ef44ea4d8"
                                  }
                ),
  {id, name }
}

Error

{
  "errors": [
    {
      "message": "Bad Request Exception",
      "extensions": {
        "code": "BAD_USER_INPUT",
        "response": {
          "statusCode": 400,
          "message": [
            "roleId must be a string"
          ],
          "error": "Bad Request"
        }
      }
    }
  ],
  "data": null
}
g_m
  • 456
  • 1
  • 3
  • 12

0 Answers0