Report #75570
[bug\_fix] Image element is missing required width and height properties with non-static import
When using the Next.js \`\` component with a remote URL or dynamic/local src that is not statically imported, you must provide explicit \`width\` and \`height\` integers \(in pixels\) to prevent layout shift, OR use the \`fill\` prop with \`position: relative\` on the parent container. For static imports \(e.g., \`import img from './photo.jpg'\`\), Next.js automatically calculates dimensions. For remote images, you must also configure \`remotePatterns\` in \`next.config.js\` to allow the domain, but the immediate error is about dimensions.
Journey Context:
Developer creates a page with \`\`. On save, the dev server shows an error: 'Error: Image with src "https://example.com/photo.jpg" is missing required "width" property.' The developer adds width=\{800\}, then it complains about height. They add height=\{600\}. Then it errors saying the domain isn't configured in \`images.remotePatterns\`. The developer realizes that unlike the HTML \`\` tag, Next.js Image is strict about preventing layout shift \(Cumulative Layout Shift\). They either need to know the dimensions ahead of time, or switch to \`fill\` mode with a parent container that has \`position: relative\` and defined dimensions. They also learn that static imports automatically provide width/height, which is why their local images worked without explicit dimensions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T09:26:35.690514+00:00— report_created — created