Search code examples
tapkey

Call to create grants for a user contact returns `500` error code


I have the following code; I am getting all the necessary variables and constructing a URL to make an axios put request:

try {
  const grant = await axios.put(
    `${this.baseUrl}/owners/${this.ownerAccountId}/grants`,
    {
      'contactId': contactId,
      'ipId': this.provider,
      'boundLockId': lockId
    },
    {
      headers: {
        'Authorization': `Bearer ${token}`
      }
    }
  )
  console.log('grantingWasSuccessFul:', grant)
  return grant.data
} catch (error) {
  console.log('error : ', error)
  throw errors.customError(
    error.response.data,
    platform.responseCodes.InternalServer,
    'Device Error',
    false
  )
}

Trying to create grant for a user contact returns the error:

      ErrorCode: 'General',
      ErrorMessage: 'Something went wrong.',
      ErrorDetails: null,
      UserErrorMessage: null
    }

What could be going wrong?


Solution

  • We are receiving an invalid request body, without a contact id. Currently this throws an 500, which is known and will be fixed soon and will then return a 400 with a proper error message.

    Please debug the request body and verify the sent body is valid and a well formatted json and the content-type is application/json; charset=utf-8