I have a page.tsx (rsc) that fetches the data using fetch call to my own route handler.
So, why not fetch directly from db?
Multiple type of users land on this page, 1. Not logged in, 2. Owners(creators of this page).
The issue is I want to use fetch requests such that the data remains cached, and** I can use revalidatePath**(in a server action), to revalidate this route handler when the creator updates the page. So it re-fetches the data the next time the page loads.
It seems to work in local dev, but gives me SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON , in vercel logs in dev, when I request the page.
Is there a work around?
Also I am doing all this so as to have the option to use revalidatePath instead of setting fixed time based cache timeout.
Please help me.