Search code examples
node.jsexpressvercel

401 eror when trying to consume express vercel endpoint


I'm experiencing a 401 error when I try to connect to my deployed production Vercel Express endpoint. I have generated a token on the Vercel dashboard and set it to never expire. By right it should connect, but I keep getting the 401 error. Any tips or help would be much appreciated.

const response = await fetch(`https://vercel-quotes-express-9n4m8bw3o-some-projects.vercel.app/api/get_myrecords`, {
        method: 'GET',
        headers: {
          Authorization: 'Bearer jtWaHKjPbV4gRZQAz6fXAXXX'
        }
});


Solution

  • I realized I was using the preview link although the cli from vercel was telling me it was production with a tick. To find you your production link, log onto vercel on the web. You will see the production link under Projects.