Next.js Discord

Discord Forum

Next image not load Next14

Answered
Md.Mohon posted this in #help-forum
Open in Discord
When i am try to load a dynamic image using next/image component then throw me an error (error image i have attached).

how to slove this error? please help me.
I am using next.js 14 app router

56 Replies

&752637460550385834
@ᴉuɐpɹɐɐ
Common House-Martin
don't quote individual people, it's against the rules
@Common House-Martin don't quote individual people, it's against the rules
ok sorry.

Can you please see this issue
Common House-Martin
where you getting the url? from your api?
Gazami crab
what did you get from console?
@Common House-Martin where you getting the url? from your api?
i am using this blurImage componet in my product page card section
@Gazami crab what did you get from console?
Common House-Martin
it's a certificate issue i think, you running a proxy? a vm? vpn? is your pc time correct?
try
npm config set strict-ssl false
if not i have no clue
@Md.Mohon no! i don't use any vm or vpn.
Gazami crab
did you check next.config?
or encoding problem. GET looks like https:// -> https%3A%2F%2Fresres:
@Gazami crab did you check next.config?
yes i am using proxy in server url
Gazami crab
can you check this please? if it's not working, it's out of my hand..:01_1_02__:

const originUrl = props?.src
const encodeUrl = encodeURIComponent(originUrl);

src={encodeUrl}
@Common House-Martin try npm config set strict-ssl false
when i am run this command then why not run my node.js server getting mongoDb error
@Gazami crab can you check this please? if it's not working, it's out of my hand..<:01_1_02__:1142108717958045887> const originUrl = props?.src const encodeUrl = encodeURIComponent(originUrl); src={encodeUrl}
if i use this then throw this error @Gazami crab
Gazami crab
can you show console of originUrl and encodeUrl
yes
@Md.Mohon yes
Northeast Congo Lion
app router or pages router?

with app router, u mneed to configure remote patterns

https://nextjs.org/docs/app/api-reference/components/image#remotepatterns
@Md.Mohon app router
Northeast Congo Lion
please share the code snippet where ur working '
ideally, the full component or page whuich is causing issues.
@Md.Mohon Click to see attachment
Is the error
@Md.Mohon Is the error
Northeast Congo Lion
did u configure remote patterns as I sent u ?
module.exports = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'res.cloudinary.com',        
    ],
  },
}
if still not working, please share ur up-to-date error alongwith the value of the image src
as others mentioned, it looks to be using an encoded url in src?
@Northeast Congo Lion did u configure remote patterns as I sent u ?
yes same to you

and still now throw same error

i not using encoded url i am using direct image ulr like https://res.cloudinary.com/wolfecom/image/upload/v1713238167/cld-sample-5.jpg
Northeast Congo Lion
okay, can u send the actual component and not a screenshot from earlier.
sure can you join meet link. cause here i am use multiple component so if you join the meet then help to me
in this image line no. 144 i am use the blurImage component
@Md.Mohon Click to see attachment
here is the blurImage component
that have i am use the next/image
Northeast Congo Lion
so if u remove the blurImage component from the parent component?
u have no error?
removing the image should mean app works fine, yes?
yes app working fine and don't have and the fetch fail error
Northeast Congo Lion
right
the error throw is the blurImage component and i am test another next 13 app using the next/image they have throw the same error.


so how can i solve this problem?

is the tls certificate error. is any network related issue?
Northeast Congo Lion
ive never had an issue with using remote image on localhost with http
i am using the local mongodb have this reason?
@Md.Mohon i am using the local mongodb have this reason?
Northeast Congo Lion
if u use other image that is not from res.cloudinary.com does it work?
Northeast Congo Lion
ok so all images break regardless of source
Answer
@Northeast Congo Lion thanks in this doc help to me
thanks a lot
Northeast Congo Lion
Awesome
So @Md.Mohon you solved the problem
yes
Northeast Congo Lion
Great news
(let me know if i chose the wrong message)