← All errors · Next.js

Invalid src prop on next/image, hostname is not configured

Exact error

Error: Invalid src prop (https://example.com/a.png) on `next/image`, hostname "example.com" is not configured under images in your `next.config.js`

What it means

next/image only optimizes remote images from hosts you explicitly allow.

Likely causes

How to fix it

  1. Add the host to remotePatterns in next.config:

    // next.config.js
    module.exports = {
      images: {
        remotePatterns: [
          { protocol: 'https', hostname: 'example.com' },
          { protocol: 'https', hostname: '*.supabase.co' },
        ],
      },
    };
  2. Restart the dev server. next.config changes are not hot-reloaded.

Related errors

Get new fixes weekly

No spam. Unsubscribe anytime. Privacy