title: Next.js: Skipping generating static sites at build time (instead: only at runtime, as getStaticProps has no data in build phase)
body: <p>I want to use the same application for different customers, where there's a different database for each (which could be on-premise).
  As a result, I have no data at the build phase (e.g. in CI/CD) that I could use to create static sites.</p>
  <p>I thought about skipping generating the sites in <code>getStaticProps</code> via an environment variable.
  When building the sites, I could tell Next.js to not use any data, something like this:</p>
  <pre><code>export const getStaticProps: GetStaticProps&lt;HomePageProps&gt; = async () =&gt; {
    const isBuildPhase = process.env.IS_BUILD;
  
    const data = isBuildPhase ? null : await fetchData();
  
    return {
      props: {
        data: data ?? null,
      },
      revalidate: 5 * 60,
    };
  };
  </code></pre>
  <p>Now, I want to create the sites only at runtime (with <code>next start</code>), because at runtime, the built application has access to its database. In each <code>getStaticProps</code> the environment variable will be configured so data is fetched. When the application starts initially, it will generate all static sites when they're accessed.</p>
  <p>Are there big downsides with this approach?</p>
  <p>Are there maybe better solutions to this problem?</p>