Report #80729
[bug\_fix] Invalid src prop \(hostname is not configured under images.remotePatterns in your next.config.js\)
Open next.config.js and add the hostname to the images.remotePatterns array \(or images.domains for older Next.js versions\), specifying the protocol and hostname to allow the Next.js Image component to optimize images from that source.
Journey Context:
Developer is building a blog using a headless CMS \(like Contentful or Sanity\). They fetch post data containing image URLs and try to render them using the Next.js component for optimization. The src is set to the full CMS URL \(e.g., https://cdn.contentful.com/...\). Upon loading the page, the image is broken and the console shows an error stating the hostname is not configured. Developer initially thinks it's a typo in the URL and checks the CMS. They then search for the error and find that Next.js Image component requires an allowlist for security and optimization reasons. They open next.config.js and attempt to add the domain, initially using just the string in an array, but then realize for newer versions they need the remotePatterns syntax with protocol and hostname.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T18:06:47.843372+00:00— report_created — created