How to deploy from Azure Repo to Vercel using Vercel with custom domain for develop branch

I am having a Next.js project which is in Azure Repo and i want to deploy the application in Vercel. I have two branches main and develop where the main branch is used for Production and develop for dev activities. In this for main branch i have added a custom domain in vercel.

I want to add a custom domain for the preview . I have used the below script in Azure pipeline but i am not sure how to add the custom domain in this pipeline.

# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- main
- develop

pool:
  vmImage: ubuntu-latest

jobs:
- job: deploy_main
  displayName: Deploy to Production
  condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'))
  steps:
  - task: vercel-deployment-task@1
    inputs:
      vercelProjectId: '***'
      vercelOrgId: '***'
      vercelToken: $(VERCEL_TOKEN)
      production: true

- job: deploy_develop
  displayName: Deploy to Preview
  condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'develop'))
  steps:
  - task: vercel-deployment-task@1
    inputs:
      vercelProjectId: '***'
      vercelOrgId: '***'
      vercelToken: $(VERCEL_TOKEN)
      production: false

As well as when i the pipeline runs the deployment becomes successful but the pipeline shows the following error

I don’t know of a way to add a custom deployment domain using vercel-deployment-task@1, so I’m going to ask the dev team about it. I know there are other ways to do set a custom preview domain though.

I asked the team about the error you reported and about whether vercel-deployment-task@1 provides a way to set a deployment alias. Will post a update here when I learn more. :slightly_smiling_face:

Thanks for waiting. The team confirmed that the CLI currently is your best option to add a custom domain to preview deployments. Depending on your workflow, assigning a custom domain to a specific branch could also work – How do I set up a staging environment on Vercel?

We have a ticket open for investigation into the error you discovered, but I don’t have any news on that front. If you have any additional details to share with the team to help with their investigation, I would be happy to add them to the ticket for you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.