Report #93791
[bug\_fix] Invalid src prop ... hostname is not configured under images.remotePatterns
Add the external image domain to \`images.remotePatterns\` \(or legacy \`domains\`\) in \`next.config.js\`. Specify protocol, hostname, and optionally port and pathname. For example: \`images: \{ remotePatterns: \[\{ protocol: 'https', hostname: 'cdn.example.com' \}\] \}\`. Root cause: Next.js Image Optimization API requires explicit allowlisting of external hosts to prevent abuse \(arbitrary image fetching/cache poisoning\) and to enable build-time validation of image sources.
Journey Context:
Developer uses \`\` from a headless CMS. In development, it works because Next.js often allows unknown hosts in dev mode or shows a warning. On production build \(\`next build\`\), the build fails with 'Invalid src prop... hostname is not configured'. Developer looks for an env var to disable this, doesn't find it. Tries to use a standard \`\` tag to bypass, losing optimization. Eventually finds the \`remotePatterns\` config in Next.js docs, adds the CMS domain with protocol and hostname, rebuilds successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:01:01.662102+00:00— report_created — created