-
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
external domains no longer working
#23590
Comments
Reproducible in Linux. |
Looks like similar issue has been described in #23523 (comment) Passing |
I have the same issue with next 10.1.3, node 14.15.4 Edit: Problem disapears for me with version 10.2.0 |
I have the same issue on both 10.1.3 and 10.2.0 node 14.16.1 |
Facing same issue |
It does seem to work in a production environment (eg. deployed to Vercel) but not in a local environment. |
This issue does prevent us from upgrading to next 10.2.0 (or 10.1.3), can we bump the priority for this bug? Thanks! |
any update on this? |
Still having to pass unoptimized={true} for local environment :( |
Image optimization for external domains definitely seems to be broken in non-production environments (local and test) since 10.1.x and including 10.2.0. |
I can't reproduce this based on the steps provided, can you provide a complete reproduction? Potentially you tried to add the config to This is what I tried:
import Image from "next/image";
export default function Home() {
return (
<>
<h1>Hello World</h1>
<Image
src="https://pbs.twimg.com/media/E00DyJhXoAYlBYL?format=jpg&name=4096x4096"
width={2000}
height={2000}
/>
</>
);
}
module.exports = {
images: {
domains: ['cdn.sanity.io', 'pbs.twimg.com'],
},
};
Deployed on Vercel (https://my-app-testing-c1actrobz-timvercel.vercel.app/) result: Note that the skewed image is because I put in |
@timneutkens Ah ok, @dstapleton92 and I aren't having issues with app start, where our command is: The error after
Despite this being in our
To get it to pass, this works: |
@dstapleton92 @timneutkens what's strange is if I do I tried this to no avail... please advise:
|
found a workaround for Jest specs 😂
|
@timneutkens this also works, but I would advise people away from using this since it involves a silly, one-off hack in prod-level code for test environment to pass.
|
Okay so I swear this was NOT working for me yesterday with local dev. I made sure to kill the dev server and restart and I was still receiving the error that the hostname was not in the domain config. Maybe the old config was being cached somewhere? After a fresh start today, it is working fine for me in local dev. |
noob idea: could it be something sanity / cdn specific, since an external source of error could've changed over night. and tim tested with pbs.twimg.com rather than sanity. |
@felipefcm @jflayhart the initial issue does not mention Jest anywhere, your issue sounds like #21549. |
I am also having this problem. Again, only when running tests (I'm using Jest and RTL). It works fine locally and when deployed to Vercel. |
Sorry for not replying anytime sooner but my original issue has been resolved. I was using a wrapper package that I wrote that was using an older version of |
I just had this problem and managed to solve it. What happened for me was the actual import used. I believe the right import you want to use is with the lowercased version of the "i" in image as opposed to uppercase.
|
Fixed in #26502 |
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. |
What version of Next.js are you using?
10.1.2
What version of Node.js are you using?
15.8.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
next dev
Describe the Bug
Since version
10.1.x
the external image domains are no longer working undernext.config.js
. Take the following basic example.Error:
Expected Behavior
Next.js
next/image
is able to render and optimise external images defined under theimages
section innext.config.js
To Reproduce
Run the most basic example that you can and try to render an image from an external domain like twitter using
next/image
.The text was updated successfully, but these errors were encountered: