Skip to content

Commit

Permalink
Fix docs for next/image unconfigured hosts (vercel#41223)
Browse files Browse the repository at this point in the history
Fix docs for next/image unconfigured hosts to mention `remotePatterns`.
  • Loading branch information
styfle authored and Kikobeats committed Oct 24, 2022
1 parent 904cdd2 commit 89842af
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions errors/next-image-unconfigured-host.md
Expand Up @@ -2,11 +2,29 @@

#### Why This Error Occurred

On one of your pages that leverages the `next/image` component, you passed a `src` value that uses a hostname in the URL that isn't defined in the `images.domains` config in `next.config.js`.
One of your pages that leverages the `next/image` component, passed a `src` value that uses a hostname in the URL that isn't defined in the `images.remotePatterns` or `images.domains` in `next.config.js`.

#### Possible Ways to Fix It

Add the hostname of your URL to the `images.domains` config in `next.config.js`:
Add the protocol, hostname, port, and pathname to the `images.remotePatterns` config in `next.config.js`:

```js
// next.config.js
module.exports = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'example.com',
port: '',
pathname: '/account123/**',
},
],
},
}
```

If you are using an older version of Next.js prior to 12.3.0, you can use `images.domains` instead:

```js
// next.config.js
Expand Down

0 comments on commit 89842af

Please sign in to comment.