Fetch revalidate always skipped
Answered
Northeast Congo Lion posted this in #help-forum
Northeast Congo LionOP
Hi all,
I have simple function inside server component, this function fetches from local api route.
Anytime I visit page where component function is called, i always see cache: skip
When trying to build, fetch fails. I need to try set this component function to cache the response from local API every 3-4 mins, any help appreciated.
I have simple function inside server component, this function fetches from local api route.
Anytime I visit page where component function is called, i always see cache: skip
When trying to build, fetch fails. I need to try set this component function to cache the response from local API every 3-4 mins, any help appreciated.
Answered by not-milo.tsx
Well first you shouldn't fetch your own api routes. Since RSCs came out you can fetch data from you db/external service directly in them.
And also there's not enough information to help you. Provide relevant code snippets and some more details about the project structure.
And also there's not enough information to help you. Provide relevant code snippets and some more details about the project structure.
14 Replies
Northeast Congo LionOP
Cache missed reason: (cache-control: no-cache (hard refresh))Well first you shouldn't fetch your own api routes. Since RSCs came out you can fetch data from you db/external service directly in them.
And also there's not enough information to help you. Provide relevant code snippets and some more details about the project structure.
And also there's not enough information to help you. Provide relevant code snippets and some more details about the project structure.
Answer
@not-milo.tsx Well first you shouldn't fetch your own api routes. Since RSCs came out you can fetch data from you db/external service directly in them.
And also there's not enough information to help you. Provide relevant code snippets and some more details about the project structure.
Northeast Congo LionOP
yea i realised the stupid mistake I made haha
i was like waitttt a minute
Ahaha, it happens. So you solved it?
@not-milo.tsx Ahaha, it happens. So you solved it?
Northeast Congo LionOP
Yeah im gonna close this actually, had another related issue but its cool
thanks for ur help 🙂
I actually cant close this forum, it says No Commands
You can only mark an answer as solution. If you don't see the option it might be just Discord bugging out, restart the app and try again.
Northeast Congo LionOP
yh discord bugging fr, restarted
eey got it
Northeast Congo LionOP
have just opened a new issue, wonder if i could get ur thoughts on that
i've never seen this issue on nextjs before
