question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I got "url" parameter is required when I use next/image

See original GitHub issue

What 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:closed
  • Created 2 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
sp0033212000commented, Sep 7, 2021

@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 the w=3840 is size param.

image

0reactions
balazsorban44commented, Feb 7, 2022

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.

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 >
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 >

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