title: Next js - Can't generate dynamic getStaticPaths with apollo client api
body: <p>I wan't to generate a list of my posts' slugs for a SSG export in next.js, using Apollo graphql client.
  Here's my code:</p>
  <pre><code>import { gql } from &quot;@apollo/client&quot;;
  import client from &quot;../../graphql/apollo-client&quot;;
  import { BLOG_POSTS, POST_DATA } from &quot;../../graphql/apollo-queries&quot;;
  
  
  export async function getStaticPaths() {
     const { loading, error, data } = await client.query({ query: BLOG_POSTS });
     const peths = data.posts.nodes.map((post) =&gt; ({
        params: { slug: post.slug },
     }));
  
     return {
        paths: peths || [],
        fallback: true,
     };
  }
  
  
  
  export async function getStaticProps({ params }) {
     const { data } = await client.query({
        query: POST_DATA,
        variables: { id: params.slug, idType: &quot;SLUG&quot; },
     });
  
     return {
        props: {
           post: data.post,
        },
     };
  }
  
  export default function BlogSlug({ post }) {
     return (
         &lt;h1&gt;{post.title}&lt;/h1&gt;
     )
  }
  </code></pre>
  <p>This is working correctly when I use <code>npm run dev</code> which starts the next application in development mode, but when I want run <code>next build &amp;&amp; next export</code>, it seems like the API isn't working and <code>data</code> returns <code>undefined</code>, thus, no pages are generated and it throws an error saying <code>TypeError: Cannot read property 'title' of undefined</code></p>