title: Next JS getServerSideProps try block failing when getting token in Vercel
body: <p>I am trying to hide one of my routes in NextJS behind firebase Auth. I am storing a token in the context and retrieving the token in getServerSideProps. This works in development but once deployed to Vercel it fails.
  I see the cookie is there after logging in but the try block fails.</p>
  <p><a href="https://i.stack.imgur.com/9KVEK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9KVEK.png" alt="enter image description here" /></a></p>
  <p>I'm wondering if it's a race condition in the production env but I am using async await.</p>
  <p>Here is the bloc that is failing.</p>
  <pre><code>export async function getServerSideProps(context) {
      //console.log(context)
      try {        
          const cookies = nookies.get(context);
          //const cookies = Cookies.get(context);
          const token = await verifyIdToken(cookies.token);
          const {uid, email} = token;
          //console.log(&quot;Token in vendors: &quot;, token);
          return {
              props: {
                  session: `Email: ${email} IUD: ${uid}`
              }
          }
      } catch (err) {
          context.res.writeHead(302, {location: &quot;/&quot;}); //login //change to welcome page
          context.res.end();
          return (
              { props: [] }
          )
      }
  }
  </code></pre>
  <p>I am using nookies and I even tries switching to cookie-js as someone suggested.
  Any help would be greatly appreciated.</p>
  <p>here is the repo:
  <a href="https://github.com/craigbauerwebdev/next-tartanbook" rel="nofollow noreferrer">https://github.com/craigbauerwebdev/next-tartanbook</a></p>
  <p>The token is set here:
  <a href="https://github.com/craigbauerwebdev/next-tartanbook/blob/master/components/Auth/Auth.js" rel="nofollow noreferrer">https://github.com/craigbauerwebdev/next-tartanbook/blob/master/components/Auth/Auth.js</a></p>
  <p>The Token is being retrieved here:
  <a href="https://github.com/craigbauerwebdev/next-tartanbook/blob/master/pages/vendors/index.js" rel="nofollow noreferrer">https://github.com/craigbauerwebdev/next-tartanbook/blob/master/pages/vendors/index.js</a></p>