-
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
next/image "url" parameter is valid but upstream response is invalid #53715
Comments
I've encountered a similar issue in the project I'm working on. It occurred when I attempted the following version upgrade: - "next": "13.4.12",
+ "next": "13.4.13", |
Same issue. EKS, running in a container. Images load fine on 13.4.12. |
Has anyone found a solution to this issue? I'm also encountering the same thing. |
Yeah, I confirm that versions above v13 don't work. Only v12 doesn't have problems with the images. |
This comment has been minimized.
This comment has been minimized.
I am also facing this issue for Absolute path images like /apple-icon.png inside the app folder. It never loads. |
Still getting this on It seems to work locally also when navigating to Not sure why it's connecting to port looking into the code it seems to be something going on in the fetch perhaps it's not using the correct port?
|
The same issue seems to occur when upgrading from: - "next": "13.5.2",
+ "next": "13.5.3", |
We have also encountered a similar issue: images loaded via However, when attempting to load the actual image in the |
Looks like this issue might be fixed in #55988 |
Can confirm |
This might help you in your solution: #56038 (comment) |
@Iulian-Dragomirescu |
The latest canary didn't fix it for me :/ |
This seems so random. For me, going back to 13.4.19 and 13.5.2 or updating to 13.5.4-canary.1 fixes it. I'm not getting it in development and production on Windows, but I am getting it on Linux, and only in production mode... |
I can also confirm that now it's working. I didn't change anything... I rebuild my docker container like twice since this morning 👀 |
Also randomly experiencing this issue. 13.4.9 fixed it for me at the moment.... |
I'm getting the |
Can confirm going back to 13.5.2 from 13.5.3 solved it for me. |
I got the same issue, and it only appear with production build run dev local can not foud it, my next version: 13.5.3 |
this was broken on 13.5.3 for me but with 13.5.4 seems like it's fixed 👍 |
like @shawngustaw after upgrade to 13.5.4 it's already fixed |
It is still not fixed yet. I upgraded to version 13.5.4 but still have the image error as above. |
Same here, the issues happening again in production: upstream image response failed for /test.png TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at async globalThis.fetch (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:109:9276)
at async invokeRequest (/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:16:12)
at async /node_modules/next/dist/server/next-server.js:362:35
at async imageOptimizer (/node_modules/next/dist/server/image-optimizer.js:537:13)
at async cacheEntry.imageResponseCache.get.incrementalCache (/node_modules/next/dist/server/next-server.js:517:61)
at async /node_modules/next/dist/server/response-cache/index.js:102:36 {
cause: InvalidArgumentError: invalid connection header
at processHeader (/node_modules/next/dist/compiled/undici/index.js:1:102994)
at new Request (/node_modules/next/dist/compiled/undici/index.js:1:100295)
at [dispatch] (/node_modules/next/dist/compiled/undici/index.js:1:64352)
at Intercept (/node_modules/next/dist/compiled/undici/index.js:2:93153)
at [Intercepted Dispatch] (/node_modules/next/dist/compiled/undici/index.js:1:115359)
at Client.dispatch (/node_modules/next/dist/compiled/undici/index.js:1:115591)
at [dispatch] (/node_modules/next/dist/compiled/undici/index.js:2:264035)
at Pool.dispatch (/node_modules/next/dist/compiled/undici/index.js:1:115591)
at [dispatch] (/node_modules/next/dist/compiled/undici/index.js:1:29874)
at Agent.Intercept (/node_modules/next/dist/compiled/undici/index.js:2:93153) {
code: 'UND_ERR_INVALID_ARG'
}
} |
Same here with
|
I confirm - still broken in 13.5.4
Ubuntu, node v18.17.1 |
Thanks for this, I updated so maybe some bugs go away but more things broke than fixed lol. |
@luca-vogels Thanks for the code to reproduce this issue! The reason you're seeing port 3000 is because its the default port assigned here: next.js/packages/next/src/server/next.ts Lines 283 to 285 in dabeb51
The solution is to pass I created a PR to demonstrate here: |
This comment has been minimized.
This comment has been minimized.
… image issues in prod env According to vercel/next.js#53715, v13.5.2 has a good chance of working correctly
This comment was marked as duplicate.
This comment was marked as duplicate.
Closing due to my message above. I also think that more users are finding this issue in the past 3 weeks when they really have a different issue: #56038 That can be fixed by upgrading to If you still have problems with the latest Next.js, please create a new issue with the steps to reproduce the problem, thanks! |
Confirmed they finally fixed this issue in 13.5.5. #corporateSabotage |
It's not working (for me). I've still got the same error, even with a clean setup.
|
I find that error occurred because in next/server/next-server.js below code is added. and always use http as protocol. const protocol = this.serverOptions.experimentalHttpsServer ? "https" : "http"; |
This issue gave me a headache. I can confirm that v13.5.5 fixes the problem. |
I haven't checked if 13.5.5 fixed it or not but even if it did, 13.5.5 doesn't work on aws beanstalk node18 / 6.0.1 |
@spbro007 It works for me using Node.js 18 running on 64bit Amazon Linux 2023/6.0.1 |
I found out that this error still exist in 13.5.6. How can I fix this? |
Hi I have the same issue in Next 13.5.5 released on IIS I did not understand how to fix the issue, the Image over https does not work |
same issue in Next 14.0.1. It was ok before(v13).
|
To everyone encountering this issue, |
I upgraded from v13.5.4 which was OK to V14.0.1 to found this problem, so I revert back to the earlier version and two days later I tried again to upgrade and it works ( the version I upgraded to is the same as before V14.0.1 so weird). |
Same problem in NextJS 14.0.0 |
I'm experiencing the same issue too in NextJS 14.0.0 |
Same issue with NextJS 14 |
The same problem in NextJS 14 |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Image optimization (next/image, next/legacy/image)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/luca-vogels/bug-next-image
To Reproduce
Run
npm run dev
ornpm run build && npm run start
Describe the Bug
When using next with a custom server like express images are not displayed anymore.
Default next image uses following route for fetching optimized images:
/_next/image/?url=...&w=...&q=...
However opening this route returns following error:
"url" parameter is valid but upstream response is invalid
Expected Behavior
Optimized image is returned
Which browser are you using? (if relevant)
115.0.5790.111
How are you deploying your application? (if relevant)
npm run start
NEXT-1681
The text was updated successfully, but these errors were encountered: