Next.js Discord

Discord Forum

Next 15.3.0 Unconfigured image host

Unanswered
Brokenwind posted this in #help-forum
Open in Discord
I'm getting the error.

Error: Invalid src prop (https://images.unsplash.com/photo-1496917756835-20cb06e75b4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1908&q=80) on next/image, hostname "images.unsplash.com" is not configured under images in your next.config.js

But this is my config:

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  images: {
    remotePatterns: [
      new URL("https://images.unsplash.com/**"),
      new URL("https://assets.aceternity.com/**"),
    ],
  },
};

export default nextConfig;


I just configured it according to the docs: https://nextjs.org/docs/messages/next-image-unconfigured-host

4 Replies

Silver Fox
As a workaround, you may be able to use the legacy [domains property](https://nextjs.org/docs/app/api-reference/components/image#domains).
Silver Fox
Looking at [the source](https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/match-remote-pattern.ts), this fails because the query parameter string in the URL is compared to that of the remote pattern. This happens by checking if [URL.search === undefined](https://github.com/vercel/next.js/blob/6f8dd7c44f81d2df5210b724d558813799efa128/packages/next/src/shared/lib/match-remote-pattern.ts#L30C7-L30C35), which is never true because [Node.js URLs](https://nodejs.org/api/url.html#urlsearch) will return an empty string rather than undefined (see [this sandbox](https://stackblitz.com/edit/node-ivtbt69h?file=index.js)).
[Issue filed](https://github.com/vercel/next.js/issues/78076) with a [pull request](https://github.com/vercel/next.js/pull/78077), hopefully this will be fixed soon.
@Silver Fox [Issue filed](https://github.com/vercel/next.js/issues/78076) with a [pull request](https://github.com/vercel/next.js/pull/78077), hopefully this will be fixed soon.
Hey thanks for creating the issue on this. Yeah it seems because of the search params. I've updated the src to not use the search param itself (which is weird)