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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
styflecommented, 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!

4reactions
styflecommented, Aug 12, 2021

It looks like the issue is caused by #27671

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

next js image component error "url" parameter is valid but ...
i was facing the same issue although i am hosting my images on cloudinary and it does work if i use the normal...
Read more >
James Singleton on Twitter: "@styfle I appreciate the quick ...
"url" parameter is valid but upstream response is invalid — next/image on 11.1 · Issue #27973 ·. ... 11.1 What version of Node.js...
Read more >
"url" parameter is valid but upstream response is invalid - Reddit
I've ran into an error when trying to use the next/image component. My images are requested from my Strapi CMS but return the...
Read more >
next js image component error "url" parameter is valid but ...
Coding example for the question next js image component error "url" parameter is valid but upstream response is invalid-Reactjs.
Read more >
Nextjs - Fixing Loading External Images and Issue of Url ...
If this image url is same as your domain name, then its fine and you do not need to do anything else. But,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found