next/image throws error
Answered
bscdev#1145 posted this in #help-forum
Hello Everyone, I am fetching https image url from my nodejs backend. But image loading fails with an error "upstream image response failed". I can able to view my image url response in browser since image url is valid.
in next.config.mjs i have already set image hostname and protocol->https.
nextjs version is 14.1.4
I tried to put
Then I also tried with loader file as recommended by nextjs but image loading still fails.
This issue pops up when image url is fetched directly from nodejs backend(localhost:8000).
please help.
in next.config.mjs i have already set image hostname and protocol->https.
nextjs version is 14.1.4
I tried to put
unoptimized flag and tried to load the image url from backend. But image loading failed.Then I also tried with loader file as recommended by nextjs but image loading still fails.
<Image
src={imageUrl}
width={90}
height={90}
className='image '
alt="image"
/>This issue pops up when image url is fetched directly from nodejs backend(localhost:8000).
please help.
4 Replies
@bscdev#1145 Hello Everyone, I am fetching https image url from my nodejs backend. But image loading fails with an error "upstream image response failed". I can able to view my image url response in browser since image url is valid.
in next.config.mjs i have already set image hostname and protocol->https.
nextjs version is 14.1.4
I tried to put `unoptimized` flag and tried to load the image url from backend. But image loading failed.
Then I also tried with loader file as recommended by nextjs but image loading still fails.
` <Image
src={imageUrl}
width={90}
height={90}
className='image '
alt="image"
/>`
This issue pops up when image url is fetched directly from nodejs backend(localhost:8000).
please help.
Well it is because imageUrl doesn’t point to a valid image most likely. When you test it, does <img> tag work?
@joulev , Thanks for your reply. Image tag does not accpet external url
next/image does accept external url
Answer
Thanks. I am checking it out.