Error uploading images to Sanity Studio due to incorrect metadata options
10 replies
Last updated: Dec 22, 2021
B
Hello. I just tried uploading a few images locally and on my hosted Sanity Studio, however every time I do I am receiving the following error: I checked the Sanity Status page and looks like everything is OK.
Upload failed The upload could not be completed at this time
Dec 22, 2021, 3:43 PM
B
Hi
To me it looks like a possible issue with my options.metadata array:
user A
, sorry I forgot to add that to the original message.{ "response": { "body": { "statusCode": 400, "error": "Bad Request", "message": "child \"meta\" fails because [\"meta\" at position 0 fails because [\"0\" must be one of [location, exif, image, palette, lqip, blurhash, none]]]", "validation": { "source": "query", "keys": [ "meta.0" ] } }, "url": "<https://xxxxxx.api.sanity.io/v1/assets/images/production?tag=sanity.studio.asset.upload&filename=brooke-cagle-Uduc5hJX2Ew-unsplash.jpg&meta=dimensions&meta=location&meta=exif>", "method": "POST", "headers": { "content-length": "248", "content-type": "application/json; charset=utf-8", "etag": "W/\"f8-CqKInPwEck24vFlC5Ogq0g/OQBQ\"" }, "statusCode": 400, "statusMessage": "" }, "statusCode": 400, "responseBody": "{\n \"statusCode\": 400,\n \"error\": \"Bad Request\",\n \"message\": \"child \\\"meta\\\" fails because [\\\"meta\\\" at position 0 fails because [\\\"0\\\" must be one of [location, exif, image, palette, lqip, blurhash, none]]]\",\n \"validation\": {\n \"source\": \"query\",\n \"keys\": [\n \"meta.0\"\n ]\n }\n}" }
options: { metadata: ['dimensions', 'location', 'exif'], },
Dec 22, 2021, 8:28 PM
B
It was ‘dimensions’… 🙄
Dec 22, 2021, 8:41 PM
B
Haha yea, I knew that was a default but I guess I didn’t think it would cause it to break if I included. Oh well. Lesson learned. Thanks for your quick response/help. Have a great day!
Dec 22, 2021, 8:45 PM
Somewhere in our docs I seem to recall seeing all of the metadata options listed. I’ll need to track that down and ensure it’s correct. Appreciate you bringing this up. Have a great day as well!
Dec 22, 2021, 8:47 PM
Ahh, right at the top here . I’ll make sure this is correct or corrected.
Dec 22, 2021, 8:48 PM
B
Thank you! Yea that’s where I found it originally too.
Dec 22, 2021, 8:49 PM
B
I guess the added message could be added / updated to “Always included” something about not including it…
Dec 22, 2021, 8:50 PM
B
since it’s always included
Dec 22, 2021, 8:50 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.