-
Notifications
You must be signed in to change notification settings - Fork 27k
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 optimization incorrectly returns 400 #23837
Comments
Yes, but it is not possible in every scenario. For example we are using presigned URLs to upload the pictures, and I believe it is not possible to set the content-type automatically with that approach. |
Closing as duplicate of #23523. |
@fulopdaniel it is
@fulopdaniel It is, just send it along in the header of the request, or in the options object when creating the presigned URL |
This issue has been automatically locked due to no recent activity. 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?
v12.18.3
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
When supplying an AWS S3 URL to the Image component from next/image, an error is returned from the server saying "The requested resource isn't a valid image.".
This is a new feature, introduced in this commit:
9821140
However the content type of an image coming from S3 in my case is 'binary/octet-stream', so 400 status code is returned, because it does not start with "image/", and the picture does not load.
Using Next.js@10.0.1 does load the image, or using a simple img tag also works.
Expected Behavior
The image should be loaded.
To Reproduce
import Image from 'next/image';
<Image src={<INSERT_S3_URL>} height={200} width={100} />
The text was updated successfully, but these errors were encountered: