Can't upload an image to a product when using a AWS presigned URL

Can't upload an image to a product when using a AWS presigned URL

1 0 2

Hi there,

I have been creating new products for our store via the REST api and directly on the admin website. We're having the same problem on both when uploading images via a url, namely a presigned url that we generate (normal public images work fine). The presigned url is viewable in the browser, and is even momentarily previewed in the upload section before the following error appearing: 

Screenshot 2021-06-28 at 15.28.04.png






The REST API is showing a similar issue 

Screenshot 2021-06-28 at 15.30.08.png





Is there a known issue with presigned url not working when trying to upload product images? Or maybe I'm missing something but can't see anything in the docs/support forum. It looks like it's inferring the image is a .png when it is however a .jpg 🤷‍♂️ 

PFA the Signed URL that'll be active for a week if anyone wants to try it on their store and maybe provide some insight.

Thanks in advance, stuck on this rn. 


Reply 1 (1)

1 0 1

I got into some trouble with this a couple weeks ago and it turned out the S3 object I uploaded didn't have a `Content-Type` or `MIME` header of `image/(jpg|png|gif|jpeg|bmp|tiff)`, etc.


Putting a proper `ContentType` key on the `params` object you pass to `Upload` (as in `import { Upload } from '@aws-sdk/lib-storage';`) seems to fix it in my case. I had the same issue where other public URLs worked but S3 will default to `application/octet-stream` or something unless you're more particular than that. Shopify can't tell it's a valid image URL if the headers on the payload don't also say so, apparently.