Server Side Fetching with another endpoint failing.
Unanswered
Western Screech-Owl posted this in #help-forum
Western Screech-OwlOP
Hello,
I'm running a FAST API backend on port 8000 and nextjs on port 3000. Whenever I try to call localhost:8000 or fastapi:8000 (i tried both) I always get
"a server-side exception has occurred (see the server logs for more information)."
Error: connect ECONNREFUSED 127.0.0.1:8000
I am 100% sure the FAST API container/service is running, i can access it from curl requests within the container running nextjs, but not from nextjs specifically. I can also access the service in client components w useEffects, but I'm not sure the best practice on the server-side. I'd really appreciate any help, i've been stuck for a few days now.
Thanks!
I'm running a FAST API backend on port 8000 and nextjs on port 3000. Whenever I try to call localhost:8000 or fastapi:8000 (i tried both) I always get
"a server-side exception has occurred (see the server logs for more information)."
Error: connect ECONNREFUSED 127.0.0.1:8000
I am 100% sure the FAST API container/service is running, i can access it from curl requests within the container running nextjs, but not from nextjs specifically. I can also access the service in client components w useEffects, but I'm not sure the best practice on the server-side. I'd really appreciate any help, i've been stuck for a few days now.
Thanks!
4 Replies
Western Screech-OwlOP
here are some images about my specific code, client side (working) and server side (not working)
if it is using on browser then cors ?
@muadpn if it is using on browser then cors ?
Western Screech-OwlOP
yes, cors is enabled on the backend