Bad request INVALID_IMAGE_OPTIMIZE_REQUEST when using the Image component with S3 #20138
Replies: 19 comments 24 replies
-
I ran into the same wall, but I found out I had my |
Beta Was this translation helpful? Give feedback.
-
Also having this issue? Any more information on how you resolved? Works fine locally. |
Beta Was this translation helpful? Give feedback.
-
Same here.. Works fine locally. But there's an issue once on Vercel. NextJS 11.1.2 |
Beta Was this translation helpful? Give feedback.
-
In next.config.js file, you have to add the domain of your aws s3 bucket. For me, it's directly streamed from Express so I just need to add the backend URL to the config file. |
Beta Was this translation helpful? Give feedback.
-
I'm also having this problem now. The image renders just fine locally but craps out when on Vercel. You can see the error on this page: https://scarce.city/marketplace/digital/QRRARE It tries to fetch: https://scarce.city/_next/image?url=https%3A%2F%2FscannableNFTs.com%2Fart%2Fthumb%2FQRRARE.gif&w=828&q=50 which results in My next.config: const config = {
images: {
domains: [
'arweave.net',
'bitcorns.com',
'cdn.bitcoincoaster.com',
'cdn.sanity.io',
'dankdirectory.files.wordpress.com',
'fakeraredirectory.com',
'fakeraredirectory.files.wordpress.com',
'hosting.photobucket.com',
'ipfs.io',
'i.imgur.com',
'mandelduck.herokuapp.com',
'metadata.spellsofgenesis.com',
'pepewtf.s3.amazonaws.com',
'phunchkins.com',
'public-scarce-city.s3.amazonaws.com',
'rarejapanesenfts.com',
'rarepepedirectory.com',
'rarepepewallet.com',
'scannablenfts.com', // <--- here it is
'thewojakway.com',
'xchain.io',
'xcp.dankdirectory.site',
'xcp.dankinfo.art',
'xcpinata.s3.amazonaws.com',
],
},
env: {
// my env
},
}; |
Beta Was this translation helpful? Give feedback.
-
Fun fact: the domains array is case sensitive so if you're trying to render an image from |
Beta Was this translation helpful? Give feedback.
-
Any luck with this? I'm getting |
Beta Was this translation helpful? Give feedback.
-
Any Update? |
Beta Was this translation helpful? Give feedback.
-
Having the exact same issue, but only on vercel, and no way of getting a hand on the error log for some reason |
Beta Was this translation helpful? Give feedback.
-
If you are still having the error after setting up your next config correctly then try this, create a function |
Beta Was this translation helpful? Give feedback.
-
I'm still having this issue - any update? |
Beta Was this translation helpful? Give feedback.
-
any updates on this issue? Same here |
Beta Was this translation helpful? Give feedback.
-
Update in 2023 June: I had the same problem for 1 particular image. I ended up using the unoptimized prop on the Next |
Beta Was this translation helpful? Give feedback.
-
any update on this issuse? |
Beta Was this translation helpful? Give feedback.
-
Same problem but returning an image from Route Handlers (look like this in production https://mydomain.vercel.app/_next/image?url=/api/images/1) |
Beta Was this translation helpful? Give feedback.
-
I am also facing the same Issue, any update on this ? |
Beta Was this translation helpful? Give feedback.
-
I deployed on vercel and had this issue. just adding "**.vercel.app" as hostname in remotePatters worked to solve this:
|
Beta Was this translation helpful? Give feedback.
-
I was able to fix this by ensuring that the Images folder in my |
Beta Was this translation helpful? Give feedback.
-
Hello, not sure what I am doing wrong here:
next-config.js:
JSX:
Getting:
when deploying on vercel.
Any idea?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions