question

Shane Dickson avatar image
Shane Dickson asked

Cannot read from request error when uploading

I'm having issues when trying to upload files using the REST api. I'm able to successfully upload files under ~10 MB in size, but when I try to upload anything larger, the upload fails with this error: "{"message":"Cannot read from request."}". I'm not prematurely ending the transfer, so it looks like the api is. I'm able to upload fine using curl, so I'm sure it's something I'm doing wrong on my end. I think I have the POST body set up correctly. This is what a successful transfer looks like: ------WebKitFormBoundaryE19zNvXGzXaLvS5C Content-Disposition: form-data; name="metadata" {"name":"testvideo.mp4","kind":"FILE","parents":["Pdws0h36QDeQy6AGov2IUA"]} ------WebKitFormBoundaryE19zNvXGzXaLvS5C Content-Disposition: form-data; name="content"; filename="testvideo.mp4" Content-Type: application/octet-stream This is a failed one: ------WebKitFormBoundaryE19zNvXGzXaLvS5C Content-Disposition: form-data; name="metadata" {"name":"testvideo.mp4","kind":"FILE","parents":["Pdws0h36QDeQy6AGov2IUA"]} ------WebKitFormBoundaryE19zNvXGzXaLvS5C Content-Disposition: form-data; name="content"; filename="testvideo.mp4" Content-Type: application/octet-stream I'm not able to see a difference between the two, except the file size. I've also set my http timeout value to something very large, so it shouldn't be timing out on my end. Any thoughts?
amazon drive
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Shane Dickson avatar image
Shane Dickson answered
I figured it out on my own. I was adding an extra boundary at the end of the http body. I removed this, and all uploads are now working. To anyone else running into "cannot read from request" errors, just make sure you have the post set up EXACTLY as it's shown in the api docs.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie Grossman avatar image
Jamie Grossman answered
Hi there, Glad you were able to resolve this. I'll pass the feedback on to the team to make it clearer in our documentation. Thanks! Jamie
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.