next.js: using revalidatePath but getting error for revalidateTag just in vercel not in local
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023
Binaries:
Node: 18.16.0
npm: 9.5.1
Yarn: 1.22.19
pnpm: 8.5.1
Relevant packages:
next: 13.4.3-canary.1
eslint-config-next: 13.3.2
react: 18.2.0
react-dom: 18.2.0
typescript: 5.0.4
Which area(s) of Next.js are affected? (leave empty if unsure)
Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue
https://gitlab.com/khemeri.med.khalil/test-revalidation
To Reproduce
Created an api revalidation endpoint to handle single post revalidation from webhooks and this is the code app/api/revalidate/post/route.ts : ` import { NextRequest, NextResponse } from “next/server”; import { revalidatePath } from “next/cache”;
export async function POST(request: NextRequest) { const body = await request.json(); console.log(“post revalidation body : “, JSON.stringify(body)); revalidatePath(”/post/” + body?.slug?.current); return NextResponse.json({ revalidated: true, now: Date.now() }); } `
Describe the Bug
so instead of working normally or getting an error related to revalidatePath , I got an error that seems related to revalidateTag :
I got this error after triggering a webhook to vercel, local prod mode no issue detected :
post revalidation body : {"_id":"60e008f3-5a71-486f-a645-10ade5630450","slug":{"current":"how-to-create-a-revalidation-api-endpoint-in-next-js-using-the-app-router","_type":"slug"}} Failed to revalidate tag post/how-to-create-a-revalidation-api-endpoint-in-next-js-using-the-app-router Error: Request failed with status 500. at FetchCache.revalidateTag (/var/task/node_modules/next/dist/server/lib/incremental-cache/fetch-cache.js:92:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async /var/task/.next/server/chunks/3616.js:2786:25
Expected Behavior
returned error should be related to revalidatePath not to revalidateTag
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
- Comments: 30 (6 by maintainers)
I wonder why they don’t write tests to insure everything is working before releasing new version that suppose to be Stable!
i got this issue static generation store missing in revalidateTag
Any updates on this? Not sure how such a critical feature like cache invalidation can be broken for multiple months.
The 500 error seems already fixed in 13.4.4 stable 👍. But revalidatePath still not fixed.
The problem mentioned had already existed in a previous version of Next.js a year ago and was successfully resolved at that time. However, with the introduction of the latest version of the app route, the issue has resurfaced once again. this is the last year issue : https://github.com/vercel/next.js/issues/38306 More clarification about the issue : problem does not occur when revalidating ‘/’ or static route , but it occurs with dynamic route “/post/[slug]” for example
@iamsoltan looking at the revalidation API endpoint of your repo, I assume you try to revalidate the path with a literal route segment e.g.
/blog/my-first-blog-postor/blog/123.But
revalidatePathneeds instead a path to the filesystem, in your case it should berevalidatePath("/blog/[slug]"). Here the link to the docs where it is explained.Any updates on this issues? Revalidation is still broken on Vercel.
We have a fix going out for the unexpected 500 issue and are still investigating single path revalidate.
I’m not encountering the 500 error, but the revalidation doesn’t actually occur. I’m not sure if my issue is related. App directory w/ Next 13.4.3. Both Vercel and Local
This really needs some attention. Critical and basic functionality. Faced the same issues with
validateTagandvalidatePathtoday.We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate.
Why was this issue marked with the
please add a complete reproductionlabel?To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository (template for
pages, template for App Router), but you can also use these templates: CodeSandbox:pagesor CodeSandbox: App Router.To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue.
Please test your reproduction against the latest version of Next.js (
next@canary) to make sure your issue has not already been fixed.I added a link, why was it still marked?
Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). “example.com”, “n/a”, “will add later”, etc. are not acceptable links – we need to see a public codebase. See the above section for accepted links.
What happens if I don’t provide a sufficient minimal reproduction?
Issues with the
please add a complete reproductionlabel that receives no meaningful activity (e.g. new comments with a reproduction link) are automatically closed and locked after 30 days.If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.
I did not open this issue, but it is relevant to me, what can I do to help?
Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the 👍 reaction on the topmost comment (please do not comment “I have the same issue” without reproduction steps). Then, we can sort issues by votes to prioritize.
I think my reproduction is good enough, why aren’t you looking into it quicker?
We look into every Next.js issue and constantly monitor open issues for new comments.
However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.
Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.
Useful Resources
Hi, can you share a reproduction/deployment where you are seeing the
revalidatePath()throw a 500 error?