Next.js Discord

Discord Forum

revalidatePath Error: Invariant: static generation store missing in revalidateTag

Answered
Cimarrón Uruguayo posted this in #help-forum
Open in Discord
Cimarrón UruguayoOP
I am trying to use revalidatePath('/dashboard/lending') at @/lib/actions-lender.ts after doing a completing a POST fetch. But I am getting the error. Error: Invariant: static generation store missing in revalidateTag
I am using the app router with the latest next js. Any help is appreciated.

14 Replies

Cimarrón UruguayoOP
ok thank you. Is there any other way that I can refresh the page and refresh cache? I tried using router.push but that doesnt seem to refresh cache.
hmm i've been using revalidatePath just fine though, that's how you are supposed to refresh the cache
you can also try router.refresh() from a client component in the page
Cimarrón UruguayoOP
I feel like i am doing something wrong. CAn you only use revalidatePath in /app directory?
afaik yes, only use it for app router pages
@joulev you can also try `router.refresh()` from a client component in the page
Cimarrón UruguayoOP
i am on /dashboard/slips/create and once the slip is created, i am redirecting the user to /dashboard/slips using router.push('/dashboard/slips') and revalidatePath('/dashboard/slips') at @/lib/action-slips.ts
@joulev afaik yes, only use it for `app` router pages
Cimarrón UruguayoOP
this probably could be the issue.
@Cimarrón Uruguayo this probably could be the issue.
/dashboard/slips is a pages router page?
Cimarrón UruguayoOP
correct
Answer
but still a nextjs bug regardless, report this to the team so they can extend revalidatePath to pages router pages
or at least they should've thrown a better error
Cimarrón UruguayoOP
will do, thank you.