'hostname "storage.googleapis.com" is not configured under images next js
I am getting the below message:
Error: Invalid src prop (https://storage.googleapis.com/agrf-upload/abcd.png) on `next/image`, hostname "storage.googleapis.com" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host
but my next.config.js is as below:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
domains: ['storage.googleapis.com', 'www.coinpayments.net', 'coinpayments.net'],
},
compiler: {
removeConsole: false,
},
images: {
minimumCacheTTL: 1500000,
},
swcMinify: true
}
module.exports = nextConfig
It was working fine until I restarted my laptop. I am now clueless. Please help me to sort it out.
Solution 1:[1]
I had another image section in the config, which was interfering the above image block (used to specify domains):
images: {
minimumCacheTTL: 1500000,
},
So now my updated next.config.js looks like:
const nextConfig = {
reactStrictMode: true,
images: {
domains: ['storage.googleapis.com', 'coinpayments.net'],
minimumCacheTTL: 1500000,
},
compiler: {
removeConsole: false,
},
swcMinify: true
}
module.exports = nextConfig
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Haren Sarma |
