Report #17619
[bug\_fix] Invalid src prop: hostname is not configured \(next/image\)
Add the external domain to the \`images.remotePatterns\` \(or legacy \`domains\`\) configuration in \`next.config.js\`. Example: \`images: \{ remotePatterns: \[\{ protocol: 'https', hostname: 'cdn.example.com', port: '', pathname: '/\*\*' \}\] \}\`. Root cause: The Next.js Image component \(\`next/image\`\) requires explicit allow-listing of external domains for security, to prevent malicious image URLs and to enable the image optimization API.
Journey Context:
Developer integrates a CMS \(Contentful, Sanity, Strapi\) or external CDN. They use the \`\` component from \`next/image\` with \`src=\{post.coverImage\}\` where the URL is \`https://images.ctfassets.net/...\`. They run \`next dev\` or build and see a big red error overlay: 'Error: Invalid src prop \(https://images.ctfassets.net/...\) on \`next/image\`, hostname is not configured under images.remotePatterns in next.config.js'. Developer searches the error, finds the Next.js Image documentation. They realize the Image component blocks external domains by default. They open \`next.config.js\`, locate the \`images\` key, and add a \`remotePatterns\` entry with the protocol and hostname from the error message. They restart the dev server. The error disappears and the image loads with Next.js optimization.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T05:51:52.055354+00:00— report_created — created