Report #56313
[bug\_fix] Invalid src prop on next/image, hostname is not configured under images in next.config.js
Add the external hostname to the \`images.remotePatterns\` array \(or legacy \`domains\` array\) in \`next.config.js\`, specifying the protocol \(https\) and hostname. For wildcard subdomains, use the \`\*\*\` pattern.
Journey Context:
You integrate a headless CMS \(like Sanity, Strapi, or Cloudinary\) or use external images from Unsplash. You use the \`next/image\` component with the full absolute URL as the \`src\` prop. In development with local images it worked fine, but now the image fails to load and the browser console displays an error stating the hostname is not configured under images in next.config.js. You check the documentation and realize that Next.js Image Optimization requires explicitly whitelisting external domains for security reasons \(to prevent abuse of the image optimization API\) and to know which URLs to optimize. You open \`next.config.js\`, locate the \`images\` key, and add the hostname to \`remotePatterns\` \(the modern replacement for \`domains\`\), specifying the protocol and hostname. After restarting the development server, the image loads correctly with Next.js optimization enabled.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:00:47.978085+00:00— report_created — created