i am fetching data from tmdb api .But the image doesn't load so i open the image in the new tab .then it shows
"url" parameter is valid but upstream response is invalid so how to resolve the issue
i am fetching data from tmdb api .But the image doesn't load so i open the image in the new tab .then it shows
"url" parameter is valid but upstream response is invalid so how to resolve the issue
Have you added the domain of the images to the next config ?
below is an example:
//next.config.js
module.exports = {
reactStrictMode: true,
webp: {
preset: "default",
quality: 100,
},
images: {
domains: ["randomuser.me", "firebasestorage.googleapis.com"],
},
//Internationalization
i18n: {
locales: ["en", "it"],
defaultLocale: "en",
},
};
What it worked in my case, was to do a clean reload of browser.
In Chrome, it is CTRL + SHIFT + R
i was facing the same issue although i am hosting my images on cloudinary and it does work if i use the normal <img/>
tag
so i changed the nextjs version on package.json
as bellow and it worked just fine:
hope it woud work for u as well
"dependencies": {
...
"next": "11.0.1",
...
}
I had forgotten to add the X-Forwaded-For and X-Real-IP headers in nginx which caused an issue with image domains i had specified in next.config.js
If you are serving with http
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
proxy_pass http://somehost:port;
}
If you are serving with uWSGI check you are including the params file as per https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html#configure-nginx-for-your-site