Fetch failed error
Answered
American Pipit posted this in #help-forum
American PipitOP
component:
route:
I get a
const message = await fetch('localhost:3000/api/employers/route.ts');
return (
<>
<Navbar user={user} />
<EmployerContent employers={employers} />
<p>{message?.json()}</p>
</>
);route:
export async function GET() {
return NextResponse.json({ message: 'Hello World!' });
}I get a
Unhandled Runtime Error Error: fetch failedAnswered by riský
you can use [
unstable_cache](https://nextjs.org/docs/app/building-your-application/caching#unstable_cache) to have the same cache as fetch5 Replies
@riský https://nextjs-faq.com/fetch-api-in-rsc
American PipitOP
I wanted to do fetch(path, {tag: ''}) so I can revalidate the tag. How can I create/revalidate a tag if I'm using supabase API directly in the component?
you can use [
unstable_cache](https://nextjs.org/docs/app/building-your-application/caching#unstable_cache) to have the same cache as fetchAnswer
@riský https://nextjs-faq.com/fetch-api-in-rsc
Pink salmon
thnaks
@American Pipitdo you have any more questions (ie was the unstable_cache recommendation good enough)