Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
I used a webp image for main product image while creating a product in Shopify products. A webhook is triggered after creating a product. All the content in the webhook payload is good. The issue is while fetching the image hosted in cdn.shopify.com the content-type is image/jpeg instead of image/webp. Due to this behavior the image file is received as a jpeg file instead of webp.
Expected: Correct header content-type: image/webp for webp images.
Example request response - used fetch(image-url):
Summary URL: https://cdn.shopify.com/s/files/1/0615/1415/4028/files/Corgiandcatfixingthewebsite_350x350.webp?v=1716707044 Status: 200 OK Source: Network Address: 2620:127:f00f:ff01:::443 Request Accept: */* Accept-Encoding: gzip, deflate, br Accept-Language: en-GB,en-US;q=0.9,en;q=0.8 Connection: keep-alive Host: cdn.shopify.com Origin: null Priority: u=3, i Referer: https://cdn.shopify.com/s/files/1/0615/1415/4028/files/Corgiandcatfixingthewebsite_350x350.webp?v=1716707044 Sec-Fetch-Dest: empty Sec-Fetch-Mode: cors Sec-Fetch-Site: cross-site User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15 Response Accept-Ranges: bytes Access-Control-Allow-Origin: * Access-Control-Expose-Headers: * Alt-Svc: h3=":443"; ma=86400 Cache-Control: public, max-age=31557600 cf-cache-status: MISS cf-ray: 88b2f32d5f6a9e7d-KTM Content-Length: 26021 Content-Security-Policy: sandbox allow-scripts allow-forms allow-modals allow-popups allow-downloads allow-top-navigation-by-user-activation Content-Type: image/jpeg Date: Wed, 29 May 2024 02:10:46 GMT Last-Modified: Wed, 29 May 2024 02:10:46 GMT Link: <https://cdn.shopify.com/s/files/1/0615/1415/4028/files/Corgiandcatfixingthewebsite_350x350.webp>; rel="canonical" nel: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800} Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=8tSBNUxLL4jtLWmF6W1cEZbkgl57EPjAXFFYFKjacp8yDzAuOa5Rr1UsJlt0QQfU8tfpAcW1ljmByBNvaDAtgFQF1WkObD2Nr5KItyOE9y73EkpP10E3m6OvX1fCfYnB2v68Gk%2FDK%2B9qRjnIQQ%3D%3D"}],"group":"cf-nel","max_age":604800} Server: cloudflare Server-Timing: imagery;dur=102.028, imageryFetch;dur=30.134, imageryProcess;dur=69.712;desc="image", cfRequestDuration;dur=545.000076, ipv6 source-length: 51042 source-type: image/webp Strict-Transport-Security: max-age=15552000; includeSubDomains; preload Timing-Allow-Origin: * Vary: Accept, Accept-Encoding X-Content-Type-Options: nosniff x-dc: gcp-us-east1,gcp-us-central1 x-request-id: fdb2c35a-040d-4ad9-bded-2ae3944c7da5-1716948645 x-shopid: 61514154028 X-XSS-Protection: 1; mode=block Query String Parameters v: 1716707044