Unhandled Runtime Error Error: Invalid src prop…
- User
Unhandled Runtime Error Error: Invalid src prop (https://d1csarkz8obe9u.cloudfront.net/posterpreviews/luxury-real-estate-logo-design-template-c2b5640f9e97f50324b61ae23b99de97_screen.jpg?ts=1681520698) on
next/image, hostname "d1csarkz8obe9u.cloudfront.net" is not configured under images in yournext.config.jsSee more info: https://nextjs.org/docs/messages/next-image-unconfigured-hostexport function getListRealste(qs) { return fetch(
${baseURL}/Realestate/Realestate.get.php?filter=1&from=0&to=10&${qs}, { method: 'GET' }) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => data); }baseURL='https://Beta.Dubz.ir'
- Assistant
The error you're encountering is due to the fact that the hostname "d1csarkz8obe9u.cloudfront.net" is not configured under the
imagesproperty in yournext.config.jsfile. Next.js imposes restrictions on external domains to ensure performance and security. You need to explicitly allow the hostnames of external images that you want to use with thenext/imagecomponent.Here's how you can configure the
next.config.jsfile to allow images from "d1csarkz8obe9u.cloudfront.net":