Skip to content
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

Next 15 Canary - 'use cache' - Error while saving cache key, deployment error #75057

Closed
williamlmao opened this issue Jan 18, 2025 · 1 comment
Labels
dynamicIO Related to dynamicIO.

Comments

@williamlmao
Copy link

Link to the code that reproduces this issue

https://github.com/williamlmao/cache-test

To Reproduce

  1. Connect to a supabase database API via rest API / fetch request, use any simple table (I included one in the repro). If you want the envs for my supabase project, please contact me!
  2. You should expect caching to work fine locally
  3. Deploy to vercel
  4. You will get a build error during deployment
Error: Failed to fetch Characters
    at a (.next/server/app/page.js:1:4180)
    at async (.next/server/app/page.js:1:4340)
Error while saving cache key: 1:07b:["gNnGMfGCu32XhRJb5suxP","8036a92083ff12d0a29d47770ee8282f2e526d9878",[{"params":"$@1","searchParams":"$@2"},"$undefined"]]1:12:{} Error: Failed to fetch Characters
    at a (.next/server/app/page.js:1:4180)
    at async (.next/server/app/page.js:1:4340)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Failed to fetch Characters
    at a (/vercel/path0/.next/server/app/page.js:1:4180)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async /vercel/path0/.next/server/app/page.js:1:4340
Export encountered an error on /page: /, exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null
Error: Command "npm run build" exited with 1

I tried moving 'use cache' to the function level as well and received a similar error

Error: Failed to fetch Characters
    at <unknown> (.next/server/app/page.js:1:4261)
Error while saving cache key: ["ge1SJkQqAT9VVH029AGFm","c036a92083ff12d0a29d47770ee8282f2e526d9878",["1"]] Error: Failed to fetch Characters
    at <unknown> (.next/server/app/page.js:1:4261)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Failed to fetch Characters
    at /vercel/path0/.next/server/app/page.js:1:4261
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Export encountered an error on /page: /, exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null
Error: Command "npm run build" exited with 1

I know 'use cache' is still experimental, but I'm not really sure if there is a suitable caching alternative in nextjs 15 right now. unstable_cache does not seem to work very well either. If this won't be fixed for some time, I would really appreciate it if someone could recommend the best way to cache a page in next 15 without 'use cache'. Thanks!

Current vs. Expected behavior

Properly deploys / caches page

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 19:03:40 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 23.5.0
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 9.15.2
Relevant Packages:
  next: 15.2.0-canary.14 // There is a newer canary version (15.2.0-canary.15) available, please upgrade! 
  eslint-config-next: 15.1.5
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A
 ⚠ There is a newer canary version (15.2.0-canary.15) available, please upgrade! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

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

dynamicIO

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

Vercel (Deployed)

Additional context

No response

@github-actions github-actions bot added the dynamicIO Related to dynamicIO. label Jan 18, 2025
@williamlmao
Copy link
Author

Just figured out it's because I pasted in the wrong anon key 🤦 - closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dynamicIO Related to dynamicIO.
Projects
None yet
Development

No branches or pull requests

1 participant