NextJS throws an error of unconfigure domains, even though my domains are already configured, this was working properly but just randomly stopped working.
Error Message:
Error: Invalid src prop (https://res.cloudinary.com/damilola-space/image/upload/c_fill,w_500,h_500,q_100,g_face,f_png/dump/IMG_1143_tgzqo2) on `next/image`, hostname "res.cloudinary.com" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host
My Current NextJS config
/** @type {import('next').NextConfig} */
const withOffline = require('next-pwa');
// eslint-disable-next-line import/no-extraneous-dependencies
const withTM = require('next-transpile-modules')([
'ui',
'utils',
'hooks',
'types',
]);
const nextConfig = withTM(withOffline({
reactStrictMode: true,
images: {
domains: [
'res.cloudinary.com',
],
},
pwa: {
dest: 'public',
register: true,
skipWaiting: true,
publicExcludes: ['!images/**/*'],
buildExcludes: [/image\/public\/images\/.*$/],
},
}));
module.exports = nextConfig;