-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image is missing required "src" property, but stack trace does not inform where #23742
Comments
@ranisalt Any workarounds for this? |
So far, when it happens, I just comment out one by one until I find the culprit 😢 |
Fixed with #27180 |
Add safety check for `CoverImage` in `/components/post-preview.js` so as to prevent error occurring in the absence of cover image for on posts listed for preview - fixes #23742.
@leerob I don't see how that PR fixes this problem. It prevents it from happening in one specific test in Next.js suite, not for the users. What I ask for is that I get a more detailed error log when it happens by mistake, by e.g. appending the file and line number if possible. |
Reopening this as it can indeed be improved 👍 |
Indeed, my bad @ranisalt! |
Add safety check for `CoverImage` in `/components/post-preview.js` so as to prevent error occurring in the absence of cover image for on posts listed for preview - fixes vercel#23742.
Most of the image errors print the In this case, the error message is printed when there is no next.js/packages/next/client/image.tsx Lines 383 to 387 in 4ea7d7b
The reason why you're seeing @timneutkens I'm curious about your thoughts on how to improve this error message. Perhaps we need to print the entire stack here next.js/packages/next/server/dev/next-dev-server.ts Lines 752 to 768 in 6acfffa
|
Any solution to this issue. |
Any solutions to this problem ? |
Faced this issue because I passed an empty string |
Currently, when a user forgets the `src` prop on an image, an error is thrown. However that error doesn't include any of the the user's code in the stack trace, so its nearly impossible to figure out which image is the culprit if there are multiple images on the page. Since this error only throws on demand when a page is visited during `next dev`, we can instead delay the error so it no longer prints on the server but prints on mount instead. At that point, we'll have the `<img>` element via ref and can print it to the web console with the stack trace. - Fixes #23742
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
10.1.3
What version of Node.js are you using?
15.11.0
What browser are you using?
Firefox
What operating system are you using?
Linux
How are you deploying your application?
next dev
Describe the Bug
Some image in the middle of the hundreds of images I have has an empty src. The error message helps nothing to find this particular image:
Expected Behavior
I'm not sure it's possible, but it would be good to know where the offending Image has been instantiated, so I could know where to put checks and guards.
To Reproduce
Add one image with an empty src in the middle of several others.
The text was updated successfully, but these errors were encountered: