Report #72431
[bug\_fix] Error: Image with src 'https://...' is missing required 'width' and 'height' properties, or hostname is not configured under images.remotePatterns in next.config.js
For local images, import them to get automatic width/height. For remote images \(external URLs\), provide explicit width and height props to next/image, and add the hostname to images.remotePatterns in next.config.js with protocol and hostname \(and optional pathname/port\) to allowlist the domain.
Journey Context:
Developer migrates from to next/image for performance. They use . Next.js dev server throws error: 'missing required width and height'. They add width=\{800\} height=\{600\} manually. Now it throws 'hostname is not configured'. Developer checks next.config.js and sees no image config. They add images: \{ domains: \['cdn.example.com'\] \} which works but they see deprecation notice. They update to images: \{ remotePatterns: \[\{ protocol: 'https', hostname: 'cdn.example.com', pathname: '/\*\*' \}\] \}. Build passes. Developer realizes next/image requires dimensions to prevent layout shift \(CLS\), and requires domain allowlisting to prevent abuse of the image optimization API \(which proxies and optimizes images, costing compute\). For local images, they learn to use static imports which provides automatic width/height.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T04:09:44.118167+00:00— report_created — created