Next.js Discord

Discord Forum

Why is it failing to fetch?

Answered
Black-capped Vireo posted this in #help-forum
Open in Discord
Black-capped VireoOP
I think I have the IQ of a pebble or I am doing something clearly wrong. Should I try UseEffect instead?
Answered by Giant panda
If you are calling it within a server component then don't fetch your own endpoint: https://nextjs-discord-common-questions.joulev.dev/fetching-own-api-endpoint-in-react-server-components
View full answer

2 Replies

Giant panda
If you are calling it within a server component then don't fetch your own endpoint: https://nextjs-discord-common-questions.joulev.dev/fetching-own-api-endpoint-in-react-server-components
Answer
Giant panda
(I think, technically speaking, it fails because the protocol is missing, but I'm not quite sure, but you shouldn't fetch anyway)