Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

Error: Invalid src prop

2 replies
Last updated: Aug 10, 2021

Error: Invalid src prop (<https://cdn.sanity.io/images/3i7e2etj/staging/02cacf40dcd5d1f5e57ca5e37b4ed09623335509-346x388.jpg?w=346&amp;q=75&amp;fit=clip&amp;auto=format>) on `next/image`, hostname "<http://cdn.sanity.io|cdn.sanity.io>" is not configured under images in your [] `next.config.js`
See more info: <https://nextjs.org/docs/messages/next-image-unconfigured-host>
I am getting this error. I have “
cdn.sanity.io ” in my next.config.js. It works if I use next/image directly in my next project, however it throws this error when I am importing a component that wraps next/image from an external component library. Does anyone have experience with this? I can see that the external library is using the wrong next.config.js but am not sure why. It looks as though it is just using the default next.config.js

Aug 9, 2021, 11:55 PM

I found that I didn’t have my peer dependencies setup correctly so it was using the incorrect next.config.

Aug 10, 2021, 3:54 AM

Good catch, George. Glad you got this working. 👍

Aug 10, 2021, 10:30 PM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.