Report #15927
[bug\_fix] next/image deprecated domains configuration
Replace the \`images.domains\` array with \`images.remotePatterns\` in \`next.config.js\`, specifying protocol, hostname, and pathname. Root cause: Next.js deprecated \`domains\` for security reasons; \`remotePatterns\` requires explicit protocol matching \(http vs https\) and allows wildcard patterns, preventing accidental allowance of malicious domains.
Journey Context:
Developer copies a \`next.config.js\` from an older Next.js 12 project into a new Next.js 14 project. The config contains \`images: \{ domains: \['images.unsplash.com'\] \}\`. When they try to use \`\`, they get error: "Invalid src prop... hostname is not configured under images in your next.config.js". They double-check the spelling and restart the dev server, but the error persists. They check the Next.js docs for next/image and discover that \`domains\` is deprecated and removed in favor of \`remotePatterns\`. They update the config to: \`images: \{ remotePatterns: \[\{ protocol: 'https', hostname: 'images.unsplash.com' \}\] \}\` and the image loads correctly. They realize the new config is stricter and requires protocol specification, which prevents mixed-content security issues.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:22:28.845653+00:00— report_created — created