Next.js Conf 2024: Your app should be Live by Default – Watch Keynote

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&q=75&fit=clip&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– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?