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

Page with fetch() call and cache: "no-store" does not switch to Dynamic Rendering #64462

Closed
josecoelho96 opened this issue Apr 14, 2024 · 1 comment · Fixed by #64511
Closed
Labels
bug Issue was opened via the bug report template. locked

Comments

@josecoelho96
Copy link

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/dynamic-rendering-with-fetch-k72l9n

To Reproduce

  1. Build the application - rpm run build
  2. Observe output. Errors will appear on terminal. Focus on TypeError: fetch failed

Current vs. Expected behavior

From what I understood from the documentation, if a request is made to some API and the option cache is set to "no-store", nextjs would switch to Dynamic Rendering. From the build output it appears that it isn't doing so. I was expecting no calls during build time.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 14.2.0-canary.9 // There is a newer canary version (14.2.1-canary.4) available, please upgrade! 
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

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

Not sure, App Router

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

next build (local)

Additional context

I'm fairly new to nextjs so I might be misunderstanding some stuff. I stopped trying on my real project, did a new example and had the same problem.

I also tried to upgrade to the latest canary but got a bunch of errors, so I decided to submit this with the canary I got from the starting template.

@josecoelho96 josecoelho96 added the bug Issue was opened via the bug report template. label Apr 14, 2024
ijjk added a commit that referenced this issue Apr 15, 2024
This ensures we properly skip calling a fetch during build-time that has
`cache: 'no-store'` as it should only be called during runtime instead.

Fixes: #64462

Closes NEXT-3114
ztanner pushed a commit that referenced this issue Apr 17, 2024
This ensures we properly skip calling a fetch during build-time that has
`cache: 'no-store'` as it should only be called during runtime instead.

Fixes: #64462

Closes NEXT-3114
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant