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

"url" parameter is valid but upstream response is invalid — next/image on 11.1 #27973

Closed
jonahallibone opened this issue Aug 11, 2021 · 7 comments · Fixed by #28045
Closed
Assignees
Milestone

Comments

@jonahallibone
Copy link

jonahallibone commented Aug 11, 2021

What version of Next.js are you using?

11.1

What version of Node.js are you using?

14.16.0

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

serverless-next.js

Describe the Bug

My images are served via S3 and signed urls. They worked locally (using next dev) until I upgraded to Next.js@11.1 this morning. I previously had an issue with this, where the MIME types were binary/octet-stream but have since changed the MIME types to image/jpg, and have had no trouble since then. I also now know that image/jpeg is preferable to image/jpg however I am unsure if this is the issue. The only error I get back is

"url" parameter is valid but upstream response is invalid

If I downgrade to Next@11.0.1, the issue is resolved.

Expected Behavior

Next image would return me my optimized image, not a 400 bad request with

"url" parameter is valid but upstream response is invalid

I see that in next.js/image-optimizer.ts this comes from a failed fetch on the href. I am curious why this would be the case now, and not in previous versions. Thinking perhaps this was a CORS error (somehow, really just trying anything) I changed my bucket policy. Error persists.

To Reproduce

Use an image signed by S3 with the MIME type of image/jpg

@jonahallibone jonahallibone added the bug Issue was opened via the bug report template. label Aug 11, 2021
@styfle
Copy link
Member

styfle commented Aug 12, 2021

Can you share the URL thats failing?

The issue might be caused by one of these PRs:

@sakhro
Copy link

sakhro commented Aug 12, 2021

Have the same problem for images that are served via firebase. Here the image url

@styfle
Copy link
Member

styfle commented Aug 12, 2021

It looks like the issue is caused by #27671

I'll submit a PR with a fix, thanks!

@styfle styfle added kind: bug and removed bug Issue was opened via the bug report template. labels Aug 12, 2021
@styfle styfle self-assigned this Aug 12, 2021
@styfle styfle added this to the Iteration 23 milestone Aug 12, 2021
@jonahallibone
Copy link
Author

@styfle Url for my issue is here

PS glad it wasn't #26705 because that closed an issue I also opened about MIME types with next/image lol

@kodiakhq kodiakhq bot closed this as completed in #28045 Aug 13, 2021
kodiakhq bot pushed a commit that referenced this issue Aug 13, 2021
- Fixes #27973 
- Reverts #27671 


The problem with PR #27671 is that it was encoding too often when it really only needed to solve the bug for `next build && next start` since `next dev` was already working.

This PR uses the alternative solution mentioned here #27210 (comment)
@styfle
Copy link
Member

styfle commented Aug 13, 2021

This has been fixed in v11.1.1-canary.5.

You can try it out today with yarn add next@canary, thanks!

@FDiskas
Copy link

FDiskas commented Aug 16, 2021

Can confirm ^11.1.1-canary.8 works. and on latest ^11.1.0 not working
Trying to use Image component on remote image https://ddxyd64xk465n.cloudfront.net/images/library/images/Supplier%20Web%20Images/Corella%20Fine%20Foods/Caesar.jpg

@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants