I’m setting up an uppy companion instance and I’ve had some success uploading files, but one day I see that my upload failed right at the end, immediately after having waited for 30 minutes for the file to transfer.
My first thought was that my CORS settings were wrong. Maybe I changed them by accident? Maybe something got reset? So I double checked my configuration. I’m using Backblaze, so my CORS rules look like this
[
{
"corsRuleName": "allowB2Uploads",
"allowedOrigins": ["https://example.com"],
"allowedOperations": [
"b2_upload_file",
"b2_upload_part",
"s3_head",
"s3_post",
"s3_put"
],
"allowedHeaders": [
"Authorization",
"Content-Type",
"X-Bz-File-Name",
"X-Bz-Content-Sha1",
"X-Bz-Info-*"
],
"exposeHeaders": ["ETag", "x-bz-content-sha1", "x-bz-file-name"],
"maxAgeSeconds": 3600
}
]
These looked fine, so I tried the uppy upload (via web browser) again, this time monitoring the Network tab of devtools while the upload progressed.
I noticed that there was a HTTP 413 error at uppy’s /complete endpoint. Oh that’s right, the files that succeeded were about 5GB files, but this latest one is 8GB.
Maybe my COMPANION_MAX_FILE_SIZE is set too low?
I set COMPANION_MAX_FILE_SIZE=99GB and restarted uppy companion, then I retried the upload. This part is kind of painful to wait for, because with an 8GB file, it takes 30+ minutes. Oh well, I guess I can write this blog post while I wait.
Ah, I think I found the issue. The npm package, body-parser, has a default limit of 100kb. The POST /complete request that is failing is 114K of json!