Next.js Discord

Discord Forum

Help with Image Loading Issue in Production (Next.js)

Unanswered
Northeast Congo Lion posted this in #help-forum
Open in Discord
Northeast Congo LionOP
Hello everyone,

I'm experiencing an issue in production where my images are no longer loading. Initially, it was only the .webp images that weren't working, but now all image extensions are affected. The requests return a 400 error with the message: "The requested resource isn't a valid image."

However, when I manually enter the image URL (/images/logo/logo.png), the image displays correctly

Could anyone please help me understand why this is happening and how I can fix it? I would really appreciate any advice or suggestions

Thank you so much in advance!

13 Replies

Northeast Congo LionOP
Logs :
 ⨯ The requested resource isn't a valid image for /images/caterer.png received null
 ⨯ The requested resource isn't a valid image for /images/hero.png received null
 ⨯ The requested resource isn't a valid image for /images/logo/logo.png received null
 ⨯ The requested resource isn't a valid image for /images/poke1.png received null
 ⨯ The requested resource isn't a valid image for /images/hero.png received null
 ⨯ The requested resource isn't a valid image for /images/logo/logo.png received null
 ⨯ The requested resource isn't a valid image for /images/icons/cactus-1.png received null
 ⨯ The requested resource isn't a valid image for /images/hero.png received null
 ⨯ The requested resource isn't a valid image for /images/icons/cactus-1.png received null
same
any resoultion 🤔
Argente Brun
been running to a similar issue as well, for now i have to use unoptimized <Image unoptimized={true}> to make things work. but still am looking for an actual fix for why its happening
Olive-sided Flycatcher
Hello!,
I don't see the path you're using, but I once got and error in production bc using relative path when import in dev mode works fine but, for production the realtive path is different, therefore is broken, so you need to use the entire path. Perhaps this could help you this time
Olive-sided Flycatcher
In that case I don't know what else to tell you, maybe a server limitation? To many images? Or something like that?
if ur image was located somewhere else in the public folder then u would need to change the path
for e.g. if ur file was at
public/a/b.png

it would be accessible at:
import anyName from "@/../public/a/b.png"
or if ur not using the src directory then the path would change again