title: nextjs RangeError: Maximum call stack size exceeded
body: <pre><code>import React from &quot;react&quot;;
  import &quot;../assets/style/global.scss&quot;;
  import cookies from &quot;next-cookies&quot;;
  import client from &quot;../lib/api/client&quot;;
  
  function MyApp({ Component, pageProps }) {
    return &lt;Component {...pageProps} /&gt;;
  }
  
  MyApp.getInitialProps = async (appContext) =&gt; {
    const appProps = await MyApp.getInitialProps(appContext);
    const { ctx } = appContext;
    const allCookies = cookies(ctx);
    const token = allCookies[&quot;accessToken&quot;];
    if (token !== undefined) {
      client.defaults.headers.Authorization = token;
    }
  
    return { ...appProps };
  };
  
  export default MyApp;
  </code></pre>
  <p>When logging in, we try to put the access token in a cookie and put the cookie value in the header in every api request. But I get this error. How can I fix it?</p>