2020-10-27 22:55:21 +01:00
# next/image Un-configured Host
#### Why This Error Occurred
2022-10-06 18:51:41 +02:00
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` .
2020-10-27 22:55:21 +01:00
#### Possible Ways to Fix It
2022-10-06 18:51:41 +02:00
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:
2020-10-27 22:55:21 +01:00
```js
// next.config.js
module.exports = {
images: {
domains: ['assets.example.com'],
},
}
```
### Useful Links
2020-11-24 15:21:32 +01:00
- [Image Optimization Documentation ](https://nextjs.org/docs/basic-features/image-optimization )
2022-10-18 07:06:50 +02:00
- [Remote Patterns Documentation ](https://nextjs.org/docs/api-reference/next/image#remote-patterns )