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

“use cache” does not serialize the serializable value (but unstable_cache serializes) #73094

Open
MrOxMasTer opened this issue Nov 22, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. dynamicIO Related to dynamicIO.

Comments

@MrOxMasTer
Copy link

MrOxMasTer commented Nov 22, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/keen-cloud-gggnf4?embed=1

To Reproduce

unstable_cache serializes everything and everything works.
All logs are output to the console

  1. Try entering mail in the field with unstable_cache
  2. Try to enter mail again in the field with unstable_cache and look at the logs (make sure there are no errors)
  3. Try to enter the mail again in the “use cache” field and make sure that the error pops up.
Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.
  [{}]
   ^^
    at stringify (<anonymous>)
Error while saving cache key: ["development","c04d358ed385c8992fa9fcf45e6ff96556234302f3",[{"ctx":{},"type":"query","path":"user.getByEmail","rawInput":"oxmaster@gmail.com","meta":"$undefined","input":"oxmaster@gmail.com","next":"$T"}]] Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.
  [{}]
   ^^

BONUS:

  1. Try replacing <main> in page.tsx with a fragment (empty tag) and make sure the error does not correspond to reality

Current vs. Expected behavior

Current: error
Expected: no error

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 16320
  Available CPU cores: 6
Binaries:
  Node: 22.10.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.12.2
Relevant Packages:
  next: 15.0.4-canary.22 // Codesandbox: (15.0.4-canary.23)
  eslint-config-next: 15.0.0
  react: 19.0.0-rc-380f5d67-20241113
  react-dom: 19.0.0-rc-380f5d67-20241113
  typescript: 5.7.1-rc
Next.js Config:
  output: standalone

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

dynamicIO

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

next dev (local)

Additional context

An unexplained error is displayed when trying to serialize a value. But “use cache” cannot serialize it, although unstable_cache serializes everything fine

@MrOxMasTer MrOxMasTer added the bug Issue was opened via the bug report template. label Nov 22, 2024
@github-actions github-actions bot added the dynamicIO Related to dynamicIO. label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. dynamicIO Related to dynamicIO.
Projects
None yet
Development

No branches or pull requests

1 participant