Report #73403
[bug\_fix] Next.js Image component external hostname not configured
Add the external domain to the \`images.remotePatterns\` array \(or legacy \`domains\`\) in \`next.config.js\`, specifying the protocol and hostname \(and port if needed\), then restart the Next.js dev server. Root cause: Next.js Image Optimization API requires explicit allowlisting of external domains for security and to prevent abuse; attempts to load images from unconfigured domains throw at runtime.
Journey Context:
You copy an image URL from your CMS \(e.g., Contentful, Shopify, or Sanity\) and paste it into the Next.js \`\` component: \`\`. The dev server immediately throws an error: "Error: Invalid src prop ... hostname 'images.ctfassets.net' is not configured under images in your next.config.js". You try using a standard \`\` tag instead, which works but loses optimization. You search the error and land on the Next.js docs. You open \`next.config.js\` and see \`images: \{ domains: \[\] \}\`. You add \`'images.ctfassets.net'\` to the domains array, save, but the error persists. After a moment, you realize you forgot to restart the Next.js dev server \(which requires a restart to pick up config changes\). You restart, and the error is gone. Later, you migrate to the newer \`remotePatterns\` syntax with protocol/hostname for stricter security.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T05:48:11.816906+00:00— report_created — created