Next.js Images 304 timeout

https://policy-scout-prod.netlify.app/

When running a ahrefs.com scan I get hundreds of 504 Gateway timeout errors. time to first byte 20,274 ms. however when I go visit the link to the image it loads perfectly fine. and when I visit the site the images load.

https://policyscout.com/_ipx/w_1080,q_75/https%3A%2F%2Fimages.ctfassets.net%2Fzd35iqw80kso%2F1sEeRhb0w698XdbIXugDxq%2F125dae8bafb099c977f6cd90343c0bdc%2Fimage2.jpg%3Ffm%3Dwebp?url=https%3A%2F%2Fimages.ctfassets.net%2Fzd35iqw80kso%2F1sEeRhb0w698XdbIXugDxq%2F125dae8bafb099c977f6cd90343c0bdc%2Fimage2.jpg%3Ffm%3Dwebp&w=1080&q=75

I noticed this issue https://github.com/netlify/next-runtime/issues/1491 not sure if its related

also noticing IPX taking a long time https://imgur.com/a/P5JFewe

the headers on the images might be wrong? not sure whats going on

That’s because you’ve enabled pre-rendering: Netlify App

Context:

Regarding issue 1491, will discuss it with devs today and get back to you.

Regarding 304 and caching…

We checked further and it appears to be responding within reasonable timings to me, mostly within 500 ms.

The screenshot that you’ve shared appears to be the time taken to “generate” the transformed images - not the timing taken to serve every image.

For example:

If a user tries to load your image for the first time - it will trigger the function and thus, could take a second or two - depending on your image’s settings. Once the user has loaded the image and their browser has cached it, any subsequent requests to that image should be much faster.

Are you not seeing that happen? If not, could you share a HAR file recording?

Thank you!

for the IPX image function. is there a way to pre-warm the image generation? we have quite a lot of articles, and if we deploy about once a day a lot of users might experience that first image load time

No way to pre-warm unfortunately. You can use some Image CDN which can process images on-the-fly - and chances are that could be faster than IPX in some cases.