'How to authenticate and deploy a Next.JS App from CircleCI to Vercel

I'm trying to create a CI-CD pipeline for my Next.JS app with CircleCI. I want to deploy the site after running tests etc in CircleCI. However, Vercel prompts me to log in via command line (in Circle CI) which I have no access to. It seems like, for Netlify, I can add environment variables which are NETLIFy_AUTH_TOKEN and NETLIFY_SITE_ID, and Netlify will pick this up automatically. I also want to achieve this in Vercel.

Output on CircleCI

output in CircleCI

In .circleci/config.yml

- run:
  name: "deploy to vercel"
  working_directory: packages/client
  command: |
    yarn vercel:deploy

Script in package.json

"vercel:deploy": "vercel --prod"


Solution 1:[1]

You need to pass --confirm flag when using vercel cli in your pipeline. Here is one example on Gitlab CI it should be similar for CircleCI https://github.com/vercel/vercel/discussions/4853

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hassen Hichri