IPX Error 500 on Nextjs Images with Cloudinary

I’m having some issues with images returning an IPX error 500 on a NextJS app. I’m using Sanity as a CMS plugged with Cloudinary to host our images and videos. Everything is working well locally or on Vercel so it seems there’s some issue with ipx.

  • NextJs 12.1.0
  • @netlify/plugin-nextjs 4.7.0
  • Site - field22-frontend
  • I’m building my website by pushing directly on our main branch on Github

Here is my netlify.toml file

  command = "npm run build"
  publish = ".next"

  package = "@netlify/plugin-nextjs"

:-1: Here is an example of an image that doesn’t work:


:+1: Here is an example of another image hosted exactly in the same way on Cloudinary that does work:


Any idea why some images are broken?


Hey @cdedreuille,

Is Cloudinary returning all images with image/* content-type header? If not, it needs to do that. I’m assuming it’s doing that for .jpg and not for .avif.

I’m not sure this is something I could customise. I don’t understand why we need to do these modifications on our side. We tested the website on Vercel with the same code and it worked without any modifications.

Is there anything we can do on Netlify side to fix this?

Unfortunately not. Images are checked for the correct content-type. If I recall correctly, this was changed on purpose to fix issues with people sending invalid images or some incorrect files to the IPX function, so I won’t think that this would be reverted any time soon.

In any case, I’ve passed it on to the team for further discussion and are now waiting on their feedback. But the immediate answer at the moment is, this is not supported.

I found crazy that a Nextjs website with images or videos hosted on Cloudinary doesn’t work on Netlify. These are 2 very popular solutions. There must be a way.

To modify your statement, images from Cloudinary that have the correct content-type header, do work. So it’s not like Netlify doesn’t support Cloudinary-hosted images. Sending an incorrect content-type header is the real problem here that needs to be fixed.