0

I use Next.js v13.4.4.

Error is here, and of course, it doesn't from a static image.

Error: An object should only be passed to the image component src parameter 
if it comes from a static image import. 
It must include height and width. 
Received {"src":"https://lh3.googleusercontent.com 

My next config is following:

const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "**.googleusercontent.com",
        port: "",
        pathname: "/**",
      },
    ],
  },

My Client Component is here:

"use client"
import Image from "next/image"

export default function ImageComponent(src: any) {

  return <Image src={src} alt="user-image" height={38} width={38} fill />
}
Jack
  • 125
  • 1
  • 1
  • 10

1 Answers1

0

I found the reason. I forgot {} bracket in argument. That's why there is another "src" inside argument's "src. Here is correct code.

"use client"
import Image from "next/image"

export default function ImageComponent({src}: any) {

  return <Image src={src} alt="user-image" height={38} width={38} fill />
}
Jack
  • 125
  • 1
  • 1
  • 10