next.js: On-Demand Revalidation does not revalidate when using the App Router and deployed to Vercel
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 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000
Binaries:
Node: 18.15.0
npm: 9.5.0
Yarn: 1.22.19
pnpm: 8.5.1
Relevant packages:
next: 13.4.5-canary.4
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 4.9.5
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/austintreneff/reproduction-app-revalidate
To Reproduce
- Clone or manually copy the minimal reproduction created here
- Deploy the project to Vercel (this is necessary because while running locally the issue does NOT exist)
- Once deployed, navigate to the home page where you will see a Date (generate at build time) and a random number (fetched at build time)
- To perform an “On-demand revalidation” navigate to the path
/api/revalidate
- You should see a 200 response confirming the validation
- Navigate back to the home page and notice that the content has not be revalidated
Describe the Bug
When deployed to Vercel, On-demand Revalidation using the App Router and revalidatePath does not revalidate data on static paths.
When running the project locally, the revalidation correctly updates the data, but once deployed to Vercel, the data never gets updated. I have confirmed everything works fine when running locally with next build && next start
Expected Behavior
I expect the data revalidation to successfully revalidate the home page of the app.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 16
- Comments: 33 (11 by maintainers)
I’m experiencing a similar issue, and both
revalidatePath
andrevalidateTag
don’t seem to be working in v13.4.5-canary.4.I have the same issue. When running locally using
pnpm build && pnpm start
therevalidatePath
is working, but when deployed to Vercel, it’s not working. Next.js v13.4.4Thank you! We will investigate this separately and report back!
similar issue: #49861
btw, I just opened a Vercel support ticket. because it suddenly doesn’t worked for me from June 2. so, it could be related to Vercel platform itself, not the problem of Next.js. 🤔
here is a link for a reproducible issue https://codesandbox.io/p/sandbox/next-js-fxis37 in dev mode it works (you can revalidate) but in production the page /post/hello never get revalidated (i tried all possible combination of https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config)
I used canary 13.4.20-canary.15 and
revalidatePath
is not working locallyWould route groups have any effect on this? Like if my filesystem path is actually
(memberPages)/items/(mainLayout)/[id]/settings/page.tsx
, should the path be that, or simply/items/[id]/settings
?