vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.95k stars 26.98k forks source link

build will yield "Failed to set fetch cache" #53695

Closed fwcontact closed 1 year ago

fwcontact commented 1 year ago

Verify canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.17.0
      npm: 9.8.1
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.13
      eslint-config-next: 13.4.13
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

Data fetching (gS(S)P, getInitialProps)

Link to the code that reproduces this issue or a replay of the bug

https://github.com/vercel/next.js/

To Reproduce

"npm run build" with 13.4.13 will yield "Failed to set fetch cache" for some fetch calls. the same code works fine in 13.4.12.

Describe the Bug

"npm run build" with 13.4.13 will yield "Failed to set fetch cache" for some fetch calls. the same code works fine in 13.4.12.

Expected Behavior

should be the same as in 13.4.12

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

kouhot commented 1 year ago

[FYI] In my case, It's fixed when I reduced response size. temporary solution though.

Versions

FerrariAndrea commented 1 year ago

[FYI] In my case, It's fixed when I reduced response size. temporary solution though.

Versions

  • node v18.14.0
  • next v13.5.6

Yes, but I can't split my API in chunks, it is sad that we have a payload limit on the new version of Next.js. Anyway, I totally understand that the new version of Next.js changes a lot from the old one, so I understand that it is really hard to manage all the issues and needs that people have. So I will just wait for a fix and big thx for the work that the Next.js team is doing

oliverkidd commented 1 year ago

Can confirm this issues persists in the latest release (14.0). In addition, as highlighted by others building a SSG site of 2k pages takes SIGNIFICANTLY longer now. 13.4.12 is the latest release that works our end. Not only is failed to set fetch/build cache gone, but the build time is 6mins vs 45mins.....

This seriously needs addressing, either as a fix or some clear documentation on why there is such a significant performance downgrade beyond 13.4.12.

petrosmm commented 1 year ago

upgraded to 14.0.0 and happy to save anyone the trouble... it still doesn't work

bryanjhickey commented 1 year ago

Would be great to see this issue receive some attention. I've had to roll back 11 sites to 13.4.3. The worst part of this issue is that it often doesn't result in a failed production deployment but will result in client-side errors to the live site.

Are others getting failed set fetch cache in successful production builds with client-side errors?

osehmathias commented 1 year ago

@shuding ? 🤞😅

jwalcher commented 1 year ago

I have residual set fetch cache errors with cause: Error: write EPIPE during successful build in 14.0.0, but not aware of any client-side errors.

FerrariAndrea commented 1 year ago

I think this issue doesn't impact the client when we see the set fetch cache error. I think that simply the cache is not written, but the data are anyway passed to the component that called the fetch. Simply, the next time we ask the same request, it will be a MISS on the cache instead of HIT, so we will call again the "real request" and of course again we should see the set fetch cache error.

In simple words, for every request that fails like that, we are just not using the cache, as if we disable the cache for these requests.

Arctomachine commented 1 year ago

This error breaks entire static page on revalidation. It gives blank white page on next visit. So it is not just "cache not working", it is "whole site is not working"

Arctomachine commented 1 year ago

In latest canary cache works. But it brings back occasional old error -4094, as mentioned in my previous comments. Breaks nothing seemingly, but clutters build logs and error is still error, after all.

Failed to update prerender cache for ad8cd525581f0ad32c245562715b261e894cfb281f4993a7275b5351e8f5b30d [Error: UNKNOWN: unknown error, open '<path to project>\.next\cache\fetch-cache\ad8cd525581f0ad32c245562715b261e894cfb2
81f4993a7275b5351e8f5b30d'] {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'open',
  path: <path to project>\\.next\\cache\\fetch-cache\\ad8cd525581f0ad32c245562715b261e894cfb281f4993a7275b5351e8f5b30d'
jbcazaux commented 1 year ago

Any plan to fix it in 13.5.X ?

FerrariAndrea commented 1 year ago

Guys, I tested the last canary 14.0.2-canary.9 and seems to be fixed

favfly-dev commented 1 year ago

Guys, This is absolutely correct, I updated to "next": "^14.0.2-canary.25", using this code npm install --save next@canary and the issue was solved, next js is not stable right now for many major changes, hopefully they will fix the issue ASAP

github-actions[bot] commented 11 months ago

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.