Next.js Discord

Discord Forum

Image component delivers the wrong image even if the URL is correct.

Answered
Cicada killer posted this in #help-forum
Open in Discord
Cicada killerOP
I am using the Image component from next/image and it was working as it should until recently.

Its starting to show the wrong image but has the correct url for that image.

let externalImageURL = "https://cdn.something.com/image.jpg"
<Image src={externalImageURL} layout={"fill"} />


Instead of getting that image im getting another image near that image in the cdn. but the build shows the correct image dom:

 <img decoding="async" data-nimg="fill" src="/_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=3840&amp;q=75" style="position: absolute; height: 100%; width: 100%; inset: 0px;" loading="lazy" sizes="100vw" srcset="/_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=640&amp;q=75 640w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=750&amp;q=75 750w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=828&amp;q=75 828w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=1080&amp;q=75 1080w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=1200&amp;q=75 1200w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=1920&amp;q=75 1920w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=2048&amp;q=75 2048w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=3840&amp;q=75 3840w"></img>


if i use the regular html <img> tag instead of Image component then the right image is shown.
Answered by DirtyCajunRice | AppDir
then delete your .next and rebuild
View full answer

5 Replies

@Cicada killer I am using the Image component from next/image and it was working as it should until recently. Its starting to show the wrong image but has the correct url for that image. js let externalImageURL = "https://cdn.something.com/image.jpg" <Image src={externalImageURL} layout={"fill"} /> Instead of getting that image im getting another image near that image in the cdn. but the build shows the correct image dom: js <img decoding="async" data-nimg="fill" src="/_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=3840&amp;q=75" style="position: absolute; height: 100%; width: 100%; inset: 0px;" loading="lazy" sizes="100vw" srcset="/_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=640&amp;q=75 640w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=750&amp;q=75 750w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=828&amp;q=75 828w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=1080&amp;q=75 1080w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=1200&amp;q=75 1200w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=1920&amp;q=75 1920w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=2048&amp;q=75 2048w, /_next/image?url=https%3A%2F%2Fcdn.something.com%2Fsimage.jpg&amp;w=3840&amp;q=75 3840w"></img> if i use the regular html <img> tag instead of Image component then the right image is shown.
clear your cache on vercel?
Cicada killerOP
its seflhosted. @DirtyCajunRice | AppDir
@Cicada killer its seflhosted. <@184479429404262410>
then delete your .next and rebuild
Answer
Cicada killerOP
ok
@Cicada killer ok
Asian black bear
Do you have fixed it, I have the same issure. I delete my .next and rebuild, but it still doesn't show the picture.