Some images are keep getting server-error: '"url" parameter is valid but upstream response is invalid' #32775
Replies: 8 comments 2 replies
-
It sounds like your image source blocks requests from your domain. Could you verify this is not the case? Have you also added the |
Beta Was this translation helpful? Give feedback.
-
Yes. This is also the case in my stage envirement which has a completely different domain. |
Beta Was this translation helpful? Give feedback.
-
I noticed on the second log, you have
which seems to be an incorrect URL. In fact, visiting it gives a 5xx response. Any idea why that URL would be cut in production? Can I also ask where you are hosting your site? It still sounds like your production requests are being blocked by the image hosting service. |
Beta Was this translation helpful? Give feedback.
-
I must have wrote a typo, sorry about that. Both https://jiroy.com and https://jiroi.com are hosted on Digital Ocean. |
Beta Was this translation helpful? Give feedback.
-
It's probably not a domain being blocked since the upstream server wouldn't know the domain name. It's likely the IP address being blocked. You can verify by running a fetch request from your current server to the upstream image: // api/test.js
const url = 'https://media.meds.se/meds/images/maxx-27397425-g-2019-11-13-111615299/455/360/0/dr-hauschka-lip-balm-4-5ml.jpg'
export default function handler(req, res) {
fetch(url).then(r => console.log('status', r.status)).catch(e => console.error('error', e))
res.end('check server logs')
} |
Beta Was this translation helpful? Give feedback.
-
You're right, I'm getting "status 503". |
Beta Was this translation helpful? Give feedback.
-
If you are getting this issue outside of using |
Beta Was this translation helpful? Give feedback.
-
I'm getting this error from URLs of certain domains. |
Beta Was this translation helpful? Give feedback.
-
What example does this report relate to?
next/image
What version of Next.js are you using?
12.0.7
What version of Node.js are you using?
14.18.1
What browser are you using?
Chrome, Safari, Firefox
What operating system are you using?
Ubuntu 20.04.3 LTS
How are you deploying your application?
next start
Describe the Bug
Error in next/images:
I've noticed that Google Search Console has started reporting a lot of server error. Every server error is regarding my images as a matter of fact.
When accessing my image directly: internal image product in Jiroy, I'm keep getting:
'"url" parameter is valid but upstream response is invalid'.
If you go to the image externally: external image product in Jiroy, it works just fine.
The error only occures on the production server, locally it works just fine.
If i open node_modules/next/dist/server/image-optimizer.js locally and write:
I'm getting:
If I insted ssh to the server and edit node_modules/next/dist/server/image-optimizer.js and write:
I'm getting:
Expected Behavior
Response in server should be status 200
To Reproduce
Optimize https://media.meds.se/meds/images/maxx-27397425-g-2019-11-13-111615299/455/360/0/dr-hauschka-lip-balm-4-5ml.jpg with next/image and host on server.
Go to https://<YOUR_DOMAIN>/_next/image?url=https%3A%2F%2Fmedia.meds.se%2Fmeds%2Fimages%2Fmaxx-27397425-g-2019-11-13-111615299%2F455%2F360%2F0%2Fdr-hauschka-lip-balm-4-5ml.jpg&w=1200&q=80
Complementary
I've set up a "proof of consept" and excluded the possibility that media.meds.se is blocking https://jiroy.com/ by setting up two new servers.
This is my code: https://github.com/royjosefsson/error-in-next-image/
The image from media.meds.se is working completely fine in:
But not in this newly bought domain:
Beta Was this translation helpful? Give feedback.
All reactions