Report #40904
[bug\_fix] next/image displays error 'hostname is not configured' for external image
Configure the image hostname in next.config.js under images.remotePatterns or images.domains
Journey Context:
Developer migrates from \`\` to Next.js \`\` for CMS content images using \`https://cdn.example.com\`. Development works but production build fails or shows console error 'hostname cdn.example.com is not configured'. Developer checks Image docs, realizes Next.js requires explicit allow-listing for security and optimization. They initially try adding to \`images.domains\` array but Next.js 14 recommends \`remotePatterns\` for better security. They configure \`images: \{ remotePatterns: \[\{ protocol: 'https', hostname: 'cdn.example.com', pathname: '/\*\*' \}\] \}\` in next.config.js. Build succeeds and image optimization works.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:07:44.695480+00:00— report_created — created