deploy-to-vercel-action icon indicating copy to clipboard operation
deploy-to-vercel-action copied to clipboard

Vercel Deploy hangs on the step when using Alias Domain and PR Preview Domain

Open JKVirus opened this issue 3 years ago • 3 comments

ALIAS_DOMAINS, PR_PREVIEW_DOMAIN

Verified that if I use "ALIAS_DOMAINS" it causes the hang up during "Assigning custom domains to Vercel deployment"

PR_PREVIEW_DOMAIN seems to be fine but doesn't do anything without ALIAS_DOMAINS it seems so it does not hang.

Screen Shot 2022-06-08 at 5 50 14 PM

steps: - name: Deply to Vercel id: DeployVercelAction uses: BetaHuhn/[email protected] with: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Required GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #Optional VERCEL_ORG_ID: ${{ secrets.ORG_ID}} #Required VERCEL_PROJECT_ID: ${{ secrets.PROJECT_ID}} #Required PRODUCTION: false GITHUB_DEPLOYMENT_ENV: Preview ALIAS_DOMAINS: | jung.vercel.app {BRANCH}-jung.vercel.app PR_PREVIEW_DOMAIN: "{BRANCH}-jung.vercel.app"

JKVirus avatar Jun 08 '22 21:06 JKVirus

More information to fix this. Looks like its Vercel Prompt thats causing this.

Screen Shot 2022-06-09 at 3 28 56 PM

JKVirus avatar Jun 09 '22 19:06 JKVirus

Solution: Add to deploy action

with:
   VERCEL_SCOPE: 'your-team-slug'

Explanation: The problem is that the deploy-to-vercel-action by default uses the default Vercel account, not the team. In your case jkim-mjhassoccom. However to deploy a custom domain vercel cli requires credentials of the team the default account is member of.

I was trying to extend VERCEL_TOKEN scope to All non-SAML Teams and it successfully authorised but failed in the next step of assigning the domain.

Setting up VERCEL_SCOPE: 'your-team-slug' fixed the problem. Then vercel cli makes sure that the cli will act with team credentials. The team that can assign custom domains. your-team-slug can be found here: https://vercel.com/teams/{YOUR_TEAM_SLUG}/settings

The good practice is also to reduce the VERCEL_TOKEN scope just to the specified team according to the least privilege principle.

I've created a PR describing it in docs: https://github.com/BetaHuhn/deploy-to-vercel-action/pull/197

KMNowak avatar Jul 08 '22 13:07 KMNowak

Nice, I also had this issue and confirmed that adding VERCEL_SCOPE fixed it!

rubencodes avatar Aug 06 '22 15:08 rubencodes