title: Why is fetch undefined for Sanity client?
body: <p>For some reason I am not able to perform a fetch using Sanity.io with Next.js. Here is me initializing the client:</p>
  <pre><code>import sanityClient from &quot;@sanity/client&quot;;
  export const client = sanityClient({
    projectId: &quot;sdnki6rg&quot;,
    dataset: &quot;production&quot;,
    apiVersion: &quot;2022-03-10&quot;,
    useCdn: true,
    token: process.env.NEXT_PUBLIC_SANITY_TOKEN,
  });
  </code></pre>
  <p>Then I import it into my index page and try to perform some queries:</p>
  <pre><code>import client from &quot;../lib/client&quot;;
  export const getServerSideProps = async () =&gt; {
    const query = &quot;*[_type == 'product']&quot;;
    const products = await client.fetch(query);
  
    const bannerQuery = &quot;*[_type == 'banner']&quot;;
    const bannerData = await client.fetch(bannerQuery);
    return {
      props: { products, bannerData },
    };
  };
  </code></pre>
  <p>My next.js dev server says: &quot;TypeError: Cannot read properties of undefined (reading 'fetch')&quot;. I believe I have all the proper dependencies installed so I'm not sure why this isn't working.</p>