Next.js Discord

Discord Forum

hostname "plus.unsplash.com" is not configured under images in your `next.config.js`

Answered
Boby posted this in #help-forum
Open in Discord
Avatar
I have added this protocal in my next.config.mjs still it's throwoing an error,

 ✓ Compiled / in 43.1s (1078 modules)
 GET / 200 in 48168ms
 ✓ Compiled in 5.4s (448 modules)
 GET / 200 in 448ms
 ○ Compiling /favicon.ico ...
 ✓ Compiled /favicon.ico in 3.8s (650 modules)
 GET /favicon.ico 200 in 4144ms
 ○ Compiling /dashboard ...
 ✓ Compiled /dashboard in 2.8s (1122 modules)
 ⨯ Error: Invalid src prop (https://plus.unsplash.com/premium_photo-1681469490747-8926a02f901e?q=80&w=1479&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D) on `next/image`, hostname "plus.unsplash.com" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host
    at Array.map (<anonymous>)
digest: "3711818451"
 GET /dashboard 500 in 4239ms

/** @type {import('next').NextConfig} */

const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'www.thecocktaildb.com'
      },
      {
        protocol: 'https',
        hostname: 'plus.unsplash.com'
      },
      {
        protocol: 'https',
        hostname: 'images.unsplash.com'
      },
      {
        protocol: 'https',
        hostname: 'images.unsplash.com'
      },
      {
        protocol: 'https',
        hostname: 'plus.unsplash.com'
      },




    ],
  },
};
Image
Answered by B33fb0n3
you need to add it like this:
            {
                protocol: 'https',
                hostname: 'plus.unsplash.com',
                port: '',
                pathname: '/**',
            },
View full answer

4 Replies

Avatar
you need to add it like this:
            {
                protocol: 'https',
                hostname: 'plus.unsplash.com',
                port: '',
                pathname: '/**',
            },
Answer
Avatar
Thanks it's working now
Avatar
Happy to help