Search code examples
box-apiboxboxapiv2

Box API 502 Server Connection Closed


I'm uploading several thousand files through the Box API, and after a few hundred uploads I'm getting a 502 Server Connection Closed error (and the response is HTML, not JSON as I would expect). Average file size is 0.5M

The errors seem to be mostly affecting the larger files, but this could just be because it is more likely for the larger files to be mid-upload when the upload fails.

I'm also retrying files on 502 failures, and I sometimes get a general 500 error response, or sometimes a local ETIMEDOUT or a socket hang up error (I'm uploading using the Node request library). Any thought as to what is the problem here? Is it that Box is somehow having trouble with the amount of stuff I'm uploading from my local computer? (I would doubt that though.)


Solution

  • It seems like this the problem was just overloading Box with requests. I was doing uploads in parallel, and after lowering the parallelism the 502 errors stopped coming up. If I kept parallelism high, when I retried requests that errored out enough times, the requests eventually went through.