Skip to content
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

passing random urls starting with / to _next/image causes 500 internal server errors #39312

Closed
1 task done
madmed88 opened this issue Aug 4, 2022 · 1 comment · Fixed by #39334
Closed
1 task done
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.

Comments

@madmed88
Copy link
Contributor

madmed88 commented Aug 4, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Binaries:
  Node: 14.19.3
  npm: 6.14.17
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 12.2.3
  eslint-config-next: 12.2.3
  react: 18.2.0
  react-dom: 18.2.0

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

@madmed88 madmed88 added the bug Issue was opened via the bug report template. label Aug 4, 2022
@madmed88 madmed88 changed the title passing random urls starting with / cause 500 internal server errors passing random urls starting with / to _next/image causes 500 internal server errors Aug 4, 2022
@balazsorban44 balazsorban44 added the Image (next/image) Related to Next.js Image Optimization. label Aug 4, 2022
madmed88 pushed a commit to madmed88/next.js that referenced this issue Aug 4, 2022
fixes vercel#39312
this is more consistent with other errors
an invalid image should cause a validation error and not a server error
ijjk pushed a commit that referenced this issue Aug 5, 2022
fixes #39312
this is more consistent with other errors
an invalid image should cause a validation error and not a server error
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants