Next.js Discord

Discord Forum

Page with fetch request is still statically generated even though { cache: "no-store" } is added

Atlantic menhaden posted this in #help-forum
Open in Discord
Atlantic menhadenOP
Hi 👋 I have a very basic page (Next 13.5.6, app router) that makes a request to an external API for some data for the page. When I make the fetch request, I add the { cache: "no-store" } option as mentioned in the docs here:

Therefore my understanding is that this should be enough to make the page SSR-only. However, when I run next build, it tries to statically generate the page, and if the API isn't available to the machine running the build command (e.g. a build server and live deployment might have access, but not locally for business reasons) then the build fails. Here is my example code:

import styles from "./page.module.scss";

async function getData() {
  const res = await fetch("", { cache: "no-store" });

  if (!res.ok) {
    throw new Error("Failed to fetch");

  return res.json();

export default async function Home() {
  const data = await getData();

  return (
    <main className={styles.main}>

I have since discovered that if you add export const revalidate = 0; or export const dynamic = 'force-dynamic'; to the page then it will definitely be SSR-only, but this seems somewhat unintuitive and not having mention of it in the two places I linked seems like an omission.

Are the docs inaccurate, or is my understanding lacking? Or is this a feature rather than a bug?

0 Replies