File upload API throws API Endpoint not found

I’m trying to upload a file with
content_type: “image/jpeg”
data: “some_insanely_long_base64”
filename: “158387245178496456382685421491.jpg”
token: “secret_token”

And I just get “API Endpoint not found”.
If I use a non-pro account I get a correct response that Pro is needed.

Maybe the base64 string is too long? Any advice @Shida ?

This is the image I tried to upload

New York Image
Also doesn’t work with a smaller one
small-round-green-vegetable.jpg (732×281)

I just checked the server logs - seems like we failed to handle the case where “data” was null. Not sure why your request gave null to the server, and also not sure why you got API endpoint not found. I’ll fix this error handling, but you might have to investigate why your request isn’t being understood correctly by the server.

Also I was able to upload your sample image just fine using:
image

It seems to be a problem with the length of the base64 string. Here are two json POST bodies to reproduce the problem (I used postman to reproduce, the small one is simply a truncated base64). You still need to replace the token.

Works: https://transfer.sh/K9w0R/body2-small-public.json (gives OK)
Doesn’t work: https://transfer.sh/pdxad/body2-public.json (gives NotFound)

These are my base64 encoding settings

val encodingFlags = Base64.NO_PADDING or Base64.NO_WRAP
val base64Data = Base64.encodeToString(data, encodingFlags)

I also tried URL_SAFE encoding and padded encoding, but it makes no difference.

I can repro on my end yeah. I’m thinking it might be some kind of configuration issue with max message size.

Found the issue, it was related to the default 256K upload limit on the endpoint which wasn’t properly upped to 50mb.

1 Like

Will be released next patch in a few days.

1 Like

Okay perfect, thank you.

Are the changes applied to the backend already?

Doesn’t seem like we did a deployment since, but I’ve forced one just now! Let me know if it worked.

1 Like

Yes, seems to work. Thanks!