-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Closed
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.
Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:41 PDT 2021; root:xnu-7195.101.2~1/RELEASE_ARM64_T8101
Binaries:
Node: 14.17.1
npm: 8.2.0
Yarn: 1.22.10
pnpm: N/A
Relevant packages:
next: 12.2.4
eslint-config-next: N/A
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
n/a
How are you deploying your application? (if relevant)
n/a
Describe the Bug
On-demand ISR
is implemented (on /api/revalidate
) and while it does flush the site cache once, hitting the endpoint a second time (or more) does not. This is happening in dev
as well as in production. CMS is used to fetch the content and to verify this bug, I have updated the content in between calls to /api/revalidate
Expected Behavior
Cache should be flushed each time with new content from the CMS (via getStaticProps
)
Link to reproduction
https://github.com/DTS-STN/Service-Canada-Labs
To Reproduce
- All pages in the app rely on
getStaticProps
to send a request to our CMS to get content. - There's a revalidate API handler (
/api/revalidate.js
) created in our app with the following code:
const REVALIDATION_ROUTES = [
"/home",
];
export default async function handler(req, res) {
// Check for secret to confirm this is a valid request
if (req.query.secret !== process.env.REVALIDATION_TOKEN) {
return res.status(401).json({ message: "Invalid token" });
}
try {
await Promise.all(REVALIDATION_ROUTES.map((route) => res.revalidate(route)));
return res.json({ revalidated: true });
} catch (err) {
console.log(err);
return res.status(500).send("Error revalidating");
}
}
- There is no
revalidate
property option declared as part of thegetStaticProps
for any of the pages
danielbruni, balasphilip and KurnosovNikita
Metadata
Metadata
Assignees
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.