title: Set Cookie with Nextjs and Vercel
body: <p>I have a NextJs app that is deployed with Vercel that is not setting the cookie. I went into the console &gt; Network and can see the request has a 200 status and the set-cookie value is present with no warning. I check the console &gt; Applications &gt; Cookies and the cookie is not found. I found a few similar questions on StackOverflow and Github, but very limited answers that didn't seem to push me to a solution.</p>
  <p>My domain structure is like this:</p>
  <pre><code>domain.com
  api.domain.com
  subdomain.domain.com
  nextapp.domain.com -&gt; deployed through vercel
  </code></pre>
  <p>The domain and subdomain apps are standard React apps deployed through AWS and the API is a nodejs (express) app. I'm having no issues with the cookies being set for the domain and subdomain apps so I'm led to believe this is an issue caused by Vercel. My API responses look like this:</p>
  <pre><code>res.status(200).cookie('token', token, { httpOnly: true }).json(...) 
  </code></pre>
  <p>with these cors options set</p>
  <pre><code>app.use(cors({
    origin: true,
    credentials: true
  })
  </code></pre>
  <p>I tried updating the cookie options in the response to the following, but neither had an effect.</p>
  <pre><code>{ httpOnly: true, sameSite: false, secure: true }
  { httpOnly: true, sameSite: 'none', secure: true } 
  </code></pre>
  <p>Is there something within Vercel that I'm missing that I should be aware of?</p>
  <p>EDIT</p>
  <p>It looks like this could be an issue with Next.JS actually. I'm not using the API layer within Next.js. My request looks something like this:</p>
  <pre><code>try {
    let response = await axios.post('https://api.domain.com/login', params, { withCredentials: true } )
  } catch(error) {
    ...
  }
  </code></pre>