I got "url" parameter is required when I use next/image
See original GitHub issueWhat version of Next.js are you using?
10.1.3
What version of Node.js are you using?
14.16.0
What browser are you using?
Chrome, Safari
What operating system are you using?
macOS
How are you deploying your application?
next start
Describe the Bug
I use next/image on localhost and EB is OK.
But, when I link EB to Cloudfront, I got "url" parameter is required
.
The following link point to exactly same server, but one of the links was failed.
Failed
https://d2ob318ly2sjhj.cloudfront.net/_next/image?url=%2Fassets%2Fimages%2Fhun_p1_main1_img%402x.jpg&w=3840&q=75
Work
http://hungerofficialsitedev.ap-northeast-1.elasticbeanstalk.com/_next/image?url=%2Fassets%2Fimages%2Fhun_p1_main1_img%402x.jpg&w=3840&q=75
Expected Behavior
Expected got the image from both address.
To Reproduce
https://codesandbox.io/s/busy-lichterman-ud8m2?file=/tailwind.config.js
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (1 by maintainers)
Top 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 >Nextjs - Fixing Loading External Images and Issue of Url ...
Fixing loading external images and see how to fix the issue of url parameter not allowed when you load the images.
Read more >Best practices to increase the speed for Next.js apps
If you have multiple images in a page, you can prioritize loading using the next/image component. Optimize your scripts. In addition to npm ......
Read more >Data Fetching: getServerSideProps - Next.js
When exporting a function called getServerSideProps (Server-Side Rendering) from a page, Next.js will pre-render this page on each request using the data ...
Read more >@prismicio/next Technical Reference - Documentation - Prismic
It automatically forwards the image's URL and dimensions to next/image. ... parameters. imgix URL parameters can be provided to <PrismicNextImage> using the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cmnstmntmn @progrmoiz The problem is the query string cache, cloudfront default behavior was ignore the query string, so you should enable it. The reason is nextjs Image component will send the image source path with the size through url query string. like:
http://example.com/assets/path/to/the/image.png?w=3840
thew=3840
is size param.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.