Repository: next.js
Issue: Build error appears when fetching with Graphql from Wordpress
Labels: Pages Router

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 16.19.1
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.2.5-canary.18
      eslint-config-next: 13.2.1
      react: 18.2.0
      react-dom: 18.2.0
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Data fetching (gS(S)P, getInitialProps)

### Link to the code that reproduces this issue

-

### To Reproduce

Everything works fine in development but when I do yarn run build the build fails:

As I can understand it has to do with fetching the data on the server and perhaps with caching.
When I change the `no-store` option to forced or revalidation, it only does one fetch at a time, for example I fetch the posts and it returns the data of another query. Only `cache: "no-store"` works fine in development, but not in production. 

This is my getData() function where I get the data from graphql.


```javascript
const getData = async (query: string) => {
  try {
    const { data } = await fetch("MY ENDPOINT", {
      method: "POST",
      cache: "no-store", // Maybe this causes the issue, but when I change this to forced cache it doesn't work on development.
      next: {
        revalidate: 1, 
      },
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        query: query,
      }),
    }).then((res) => res.json());

    return data;
  } catch (error) {
    console.error(error);
  }
};
```


export default getData;

This is my query:

```javascript
export const getPostBySlug = (slug: string) => {
  const getPost = `
  query PostBySlug {
    postBy(slug: "${slug}") {
      id
      content(format: RENDERED)
      title
      date
    }
  }
    `;

  return getPost;
}
```

And this is how I call the `getData()` in my component:


```javascript
export default async function Post({
  params: { post },
}: {
  params: { post: string };
}) {
  const { postBy } = await getData(getPostBySlug(post));
  
  return (
    <article>
      // Content
    </article>
  );
}
```








### Describe the Bug

When I do `yarn run build` I get the error bellow. *If do `yarn run dev` everything works fine.

info  - Linting and checking validity of types
info  - Collecting page data
[    ] info  - Generating static pages (0/6)DynamicServerError: Dynamic server usage: no-store fetch https://my-website.com/graphql /page
    at C:\Users\kiria\Desktop\web\web\node_modules\next\dist\server\lib\patch-fetch.js:221:37
    at C:\Users\kiria\Desktop\web\web\node_modules\next\dist\server\lib\trace\tracer.js:92:36
    at NoopContextManager.with (C:\Users\kiria\Desktop\web\web\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:7057)
    at ContextAPI.with (C:\Users\kiria\Desktop\web\web\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:516)
    at NoopTracer.startActiveSpan (C:\Users\kiria\Desktop\web\web\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:18086)
    at ProxyTracer.startActiveSpan (C:\Users\kiria\Desktop\web\web\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:18847)
    at C:\Users\kiria\Desktop\web\web\node_modules\next\dist\server\lib\trace\tracer.js:81:107
    at NoopContextManager.with (C:\Users\kiria\Desktop\web\web\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:7057)
    at ContextAPI.with (C:\Users\kiria\Desktop\web\web\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:516)
    at NextTracerImpl.trace (C:\Users\kiria\Desktop\web\web\node_modules\next\dist\server\lib\trace\tracer.js:81:32) {
  digest: 'DYNAMIC_SERVER_USAGE'
}

### Expected Behavior

To be able to run a succesfull build.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_