Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Invariant: static generation store missing in revalidateTag

Error: Invariant: static generation store missing in revalidateTag

I’ve used revalidatePath(path); in an app router project in a 'use client', a component without a header, and 'use server'. Everytime I get

Error: Invariant: static generation store missing in revalidateTag_[hash-here]

Using next 14.0.1

like image 702
Kirk Strobeck Avatar asked Dec 19 '25 23:12

Kirk Strobeck


2 Answers

create file called actions.ts to the /app/actions.ts ....put this example :

"use server";

import { revalidateTag } from "next/cache";

export default async function action() {
  revalidateTag("profile");
}

now just call the action and enjoy...

like image 103
Custom Bjr 3 Avatar answered Dec 21 '25 22:12

Custom Bjr 3


RevalidateTag should be used in the server layer, and also it usually used when you have performed an action in the server, which might be in a server action, which is a great way of hiding data. I'd recommend to revalidateTag after you have confirmed success in the server action where you performed the PUT/POST

like image 21
Jhonatan Avatar answered Dec 21 '25 23:12

Jhonatan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!