firebase / firebase/firebase-tools

Nextjs ISR cache not invalidated on Firebase

Open
#6,690 0 comments 2 reactions 0 assignees View on GitHub
integration: web frameworks type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

I'm using NextJS 14 and Firebase hosting with SSR on Google Cloud functions. With the new app router I'm using the `generateStaticParams` function to generate the pages at build time. When the data displayed in my page changes I'm applying the `revalidatePath` function, it works like a charm locally (next build then next start) and it works too on Vercel.
Unfortunately on Firebase calling `revalidatePath` does not invalidate the page.

The code looks like :

```tsx
// events/reports/[id]
export async function generateStaticParams() {
const reports = await findReports();
return reports.map(({id}) => ({params: {id}}));
}

export default async function ReportPage({params}: { params: { id: string } }) {
const {data} = await findReport(params.id);
return (
<>
{data}

)
};
```

In another page I call ```revalidatePath(`/events/reports/${id}`);```

### [REQUIRED] Environment info

**firebase-tools:** 13.0.1

Platform: OSX Sonoma

### [REQUIRED] Test case

### [REQUIRED] Steps to reproduce

1. Create a page with a NextJs generateStaticParams() function
2. Change the data display on the page
3. Call revalidatePath(`mypage`); to invalidate the cache

### [REQUIRED] Expected behavior

The page should be updated displaying the data that has changed

### [REQUIRED] Actual behavior

The page is not updated,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.