passing random urls starting with / to _next/image causes 500 internal server errors #39312
Closed
1 task done
Labels
bug
Issue was opened via the bug report template.
Image (next/image)
Related to Next.js Image Optimization.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
create a new next app using create-next-app, build and run server locally
visit http://localhost:3000/_next/image?url=/testing/&w=256&q=75 and you will receive a 500 error with this message:
Unable to optimize image and unable to fallback to upstream image
This also happens in production. Any Url that starts with / will cause this error.
This was introduced by this pull request: https://github.com/vercel/next.js/pull/34899/files
Expected Behavior
This should return a 400 or 404 error and not a 500 error.
Link to reproduction
https://stackblitz.com/edit/vercel-next-js-ceaw9w?file=README.md
To Reproduce
visit https://vercel-next-js-ceaw9w--3000.local.webcontainer.io/_next/image?url=/testing/&w=256&q=75 in the stackblitz link
The text was updated successfully, but these errors were encountered: