"Unknown error has occurred (code: -1)" when uploading Static Assets

Hi, I wrote my own code to upload static assets to Cloudflare by following this guide: https://developers.cloudflare.com/workers/static-assets/direct-upload/
error: Failed to upload asset files: An unknown error has occurred. Please contact support: https://cfl.re/3WgEyrH (Code: -1)
It's been working until recently, it's failing randomly. It doesn't fail for all of my apps, just one (so I can confirm my implementation does at least work some of the time). I need help debugging since the error message provides no information.
3 Replies
Walshy
Walshy2w ago
?link can you please link your account @sam so we can take a look?
SuperHelpflare
Please use the /link command to authenticate with your Cloudflare account and link it to your Discord user. This helps Cloudflare employees access your details more quickly and provide support. It also makes future support requests easier, since your account will already be linked.
sam
samOP2w ago
I managed to figure it out. I was default content type to application/octet-stream instead of application/null like wrangler does. If you upload a bucket of assets containing application/octet-stream and application/json, then you get this dead-end error. If I ignored the file on first upload and then re-uploaded, it worked. Most likely because it was in a bucket of its own. There is definitely a bug in Cloudflare's asset upload API.

Did you find this page helpful?