Report #11441
[bug\_fix] Error: Invalid src prop on \`next/image\`, hostname "cdn.example.com" is not configured under images.remotePatterns in next.config.js
Open \`next.config.js\` and add the external domain to the \`images.remotePatterns\` array \(or \`domains\` in older versions\) under the \`images\` key. Example: \`images: \{ remotePatterns: \[\{ protocol: 'https', hostname: 'cdn.example.com' \}\] \}\`.
Journey Context:
Developer integrates a CMS and uses the Next.js Image component to render images from an external CDN like Cloudinary or Contentful. In development with \`next dev\`, the image appears to work, but upon running \`next build\` for production, the build fails with an error about the hostname not being configured. Developer initially tries to bypass by using a standard \`\` tag, losing optimization benefits. After consulting the error message, developer adds the specific CDN domain to \`next.config.js\` under \`images.remotePatterns\`, allowing the build to complete and images to be optimized via Next.js loader.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:19:39.662138+00:00— report_created — created