Tranform Images not working with Large Media with Sapper

Hi, @erflynn21. Thank you for sending us the a link to the site in question.

The issue is happening because the site’s javascript service worker is returning an error for this URL. There is more information about service workers here:

Netlify isn’t sending the error because the request never reaches our CDN nodes. Instead the local service worker (in the browser) is intercepting the HTTP request and returning the error. If you make the HTTP request directly to our CDN, it does work:

$ curl -svo /dev/null 'https://<some site subdomain here>.netlify.app/path/to/image.jpg?nf_resize=fit&w=500'  2>&1 | egrep '(\*   Trying|< )'
*   Trying 165.227.0.164...
< HTTP/2 200
< alt-svc: clear
< cache-control: public, max-age=0, must-revalidate
< content-length: 11874
< content-type: image/jpeg
< date: Wed, 23 Sep 2020 06:24:07 GMT
< etag: f932aee6012d29a3879be682ee148a775dae1a4b8b221519be7c3c09089498c0
< via: 1.1 google
< x-bb-gen-id:
< age: 19
< server: Netlify
< vary: Origin
< x-nf-request-id: e4e2c936-17d6-40a1-87d7-be5e757ea725-19182526
<

Obviously, the URL in the curl example is not the actual URL.

However, if you do use curl or wget to fetch the actual URL from the PM, it does work. This is because wget and curl don’t run javascript and are therefore not using the service worker.

The only reason it doesn’t work in the browser is the service worker incepts the HTTP request there and the service worker is what returns the error.

If there are other questions about this, please let us know.