Replies: 5 comments 1 reply
-
|
I've also created a question on StackOverflow |
Beta Was this translation helpful? Give feedback.
-
|
The issue is that, next/image works a bit differently than you might think. The image src, points to a So the whole dynamic thing, of disable server side rendering has no effect, for your issue. I guess you could do: And since that's all happening server side, you'd be fine. You probably also need to add these to the next.config.js file, either as remote patterns or domains, though the former is preferred. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @icyJoseph, That feature of next/image is making the issue in the environment my app runs. API & the UI are in docker container (& under the same network). Next.js is allowed to call API using |
Beta Was this translation helpful? Give feedback.
-
|
Did you get a solution for this? |
Beta Was this translation helpful? Give feedback.
-
|
Context
Why Fix (minimum viable)
Notes
If this solves it, please Mark as answer so others can find it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
In Short:
I've
api&webservices in thedocker-compose.yamlfile. Currently everything works perfectly except Next Image(next/image) failing on a client component.As the component is a client component it should fetch the image. Following is the error in cli (so it runs in server).
Note: The images this failed to fetch are available with the API URL (
http://localhost:3000/uploads/sample/9.png) from host.Following is the component
I know that Next.js tries to render client components in the server too. So I've imported it like
to disable server rendering. But I am still facing the error. As far as I can tell. As the component is still being rendered on the server. It fails to pull the image because the URL (
p.imgUrlinPostImgcomponent) is unavailable on the server. btw, it'shttp://localhost:3xxx/path/to/img.ext. In the server instead oflocalhostwe need docker service name there which isapiin my case. but how do I configure that?Thank you in advance for the help :)
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions