Next.js Discord

Discord Forum

Invalid src prop error with Image Component

Unanswered
OMikkel posted this in #help-forum
Open in Discord
Avatar
OMikkelOP
Hey i am getting an error with the Image Component in dev mode.
I cant figure out why it works in prod fine, but in dev it throws an error.

I am using Nextjs 14 and using the new remotePatterns in the nextConfig.

Here is my config:
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
    images: {
        formats: ['image/webp'],
        remotePatterns: [
            {
                protocol: "https",
                hostname: "cdn.omikkel.com",
            }
        ]
    },
}

module.exports = nextConfig


Error:
Error: Invalid src prop (https://cdn.omikkel.com//1/Profile_pic_O_Mikkel_round_7e71250c6e.png) on `next/image`, hostname "cdn.omikkel.com" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host


Does anyone know the reason why it is not recognising the set config.

0 Replies