0

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;

Damiisdandy
  • 357
  • 3
  • 12
  • are you restarting your dev server after changing `next.config.js` file? – Moein Moeinnia Sep 15 '22 at 12:16
  • Double check that you restarted the dev server, also double check the components are loading from the right places e.g. `next/Image` instead of `next/image` – Ranson Namba Sep 16 '22 at 01:04
  • If you're using `next-pwa` v5.6.0 or above, make sure you're using it correctly in `next.config.js`. See [Build error when compiling Next.js app using next-pwa](https://stackoverflow.com/questions/73585089/build-error-when-compiling-next-js-app-using-next-pwa). – juliomalves Sep 16 '22 at 19:11

0 Answers0