Error 5408 when uploading images via direct upload

We’re having an issue where we receive repeated timeout errors when uploading images via the Direct Upload API. We’ve observed this repeatedly across multiple machines and network connections, and across various image sizes ranging from a few kilobytes to 10mb. We’re uploading the images via the browser’s fetch API. The only thing in common between the machines and networks is that they’re all in Norway. We’ve used Wireshark to analyse the packets being sent during the upload process, and see that, in cases where the timeout occurs, the machine stops sending image packets to the Direct Upload IP address after a few seconds. After approximately 30 seconds have elapsed, the endpoint returns a 5408 error. From Cloudflare’s perspective it makes sense to return that error, since the endpoint indeed never received the full image. But what we don’t understand is why the network would suddenly stop sending the image packets. Interestingly, the problem only occurs when uploading several images in quick succession (with a unique Direct Upload URL per image). In a given upload batch of 10 images, anything from one to all ten images could receive a timeout response from Cloudflare. It seems almost at random as to whether an upload will fail or not; we also observe quite often that they all succeed. We see via Wireshark that image uploading takes place via a stream. Our hypothesis is that Cloudflare is for some reason closing this stream prematurely, stopping the client from uploading the image. Does anyone have any insight into whether this is likely, or what the problem might otherwise be?
1 Reply
deerob4
deerob42w ago
Worth mentioning that this happens both when uploading serially and when in parallell (though of course to different direct upload URLs).