Skip to content

Why can't you disable Vercel Caching on API routes #78582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amunim opened this issue Apr 26, 2025 · 0 comments
Closed

Why can't you disable Vercel Caching on API routes #78582

amunim opened this issue Apr 26, 2025 · 0 comments

Comments

@amunim
Copy link

amunim commented Apr 26, 2025

Link to the code that reproduces this issue

https://codesandbox.io/p/live/f8229d08-1273-49bc-aefb-1063e88fa681

To Reproduce

Create a new API
Deploy on Vercel
Use new Date, and just return Date
Invoke it twice, and you're gone.

Current vs. Expected behavior

**EDIT: ** As soon as you purge the data it works. But this isn't even a solution.

I am using a webhook that registers users in my DB via prisma. Now For a trial period need to add month from current date. Such a simple task on vercel keeps on giving me past dates and the DB is updated with invalid subscription.

I have all this on top of my app router

export const dynamic = 'force-dynamic';
export const fetchCache = 'force-no-store';
export const revalidate = 0;

And even changed the code to this:

const startDate = moment().toDate();
        const endDate = moment(startDate).add(1, 'month').toDate();

Still no luck on vercel. Users can't be registered since a third party redirects to this webhook that registers the user.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 16219
  Available CPU cores: 8
Binaries:
  Node: 21.5.0
  npm: 10.2.4
  Yarn: 1.22.22
  pnpm: 9.12.3
Relevant Packages:
  next: 15.1.7 // There is a newer version (15.3.1) available, upgrade recommended!     
  eslint-config-next: 15.1.7
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.3.1) available, upgrade recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.

Which area(s) are affected? (Select all that apply)

Use Cache

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed)

Additional context

No response

@amunim amunim closed this as completed Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant