POST /api/v2/uploads returns 422 saying size is missing | Community
Skip to main content

POST /api/v2/uploads returns 422 saying size is missing

  • November 8, 2022
  • 1 reply
  • 0 views

Koichi

About 4 days ago (Nov 3, 2022), we started to see 422 errors when we hit POST /api/v2/uploads. The error message is {"error"=>"RecordInvalid", "description"=>"Record validation errors", "details"=>{"size"=>[{"description"=>"Size Size is not included in the list (1..1073741824)"}]}},

Based on the documentation at https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/, size is not mandatory. Therefore, the API shouldn't return 422. Can you let me know how we can resolve this? We are using zendesk_api ruby gem 1.36.0. Unless we modify the gem, I suppose we are not able to set the size property in the API request.

1 reply

Greg29
  • November 8, 2022

Hi Koichi! I've been digging through this to see if I can figure out what's going on here. What I suspect is going on is that the filename is being truncated while we're processing it (for some reason), so when we compare the original filename against the processed filename, it doesn't match and thus we treat it as a zero kb file and reject it. Therefore the file size error is saying 0 is not in the range of size (1 byte to 1 gigabyte, in binary).

I would check to see how the affected users are adding the files, as there may be something to the specific method that is causing this, e.g. dragging a file from an email. For what it's worth, I checked our logs and this is not something that I'm seeing happen in your instance outside of the particular set of PDFs. Everything else seems to be working as expected.