Hello together,
I currently have the problem that I don’t understand what I need to write in .gitlab-ci.yml so that I can make a deployment AND then link the dev domain. My goal is to have a preview environment on a specific domain.
Automatic Vercel deployment via Gitlab hooks are turned off.
I’ve spent hours researching and trying here, but can’t find a good solution.
This is what important parts of my .gitlab-ci.yml look like:
Hey @alexba! If the rest of the script is working how you like, I would just add a vercel alias line after vercel deploy to apply your custom dev domain.
I have tried something similar (although I haven’t mentioned it yet):
project_deploy_dev:
extends: .project_deploy
environment:
name: dev
script:
# Deploy to Vercel
- vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
- DEPLOYMENT_URL=$(vercel deploy --token=$VERCEL_TOKEN)
- vercel alias set $DEPLOYMENT_URL domain1.com --token=$VERCEL_TOKEN --scope=$VERCEL_ORG_ID
- vercel alias set $DEPLOYMENT_URL domain2.com --token=$VERCEL_TOKEN --scope=$VERCEL_ORG_ID
rules:
- if: '$CI_COMMIT_BRANCH == "develop"'
when: manual
However, I’m getting the following error:
Vercel CLI 36.0.0
> Assigning alias domain1.com to deployment shop-af3mwp9nv-i-example.vercel.app
Fetching domain domain1.com under example
Error: You don't have access to the domain domain1.com under example.
I should have access to the domain. It’s already linked.
Check the owner of the domains. If they currently belong to your personal account, move them so that the team owns the domains instead. Then give your workflow a try.
If that doesn’t work then I have one more thing to try. You may have already tried this next idea, but typos are a common issue so I always like to suggest checking this when something looks like it should work but doesn’t. Copy the domain from your project settings and past it as your DEPLOYMENT_URL value to make sure it’s exactly the same. Then give your workflow another try.
Please let me know whether either of those tricks gets it working for you.
Thanks for waiting. Having the domain owned by a different team explains the error message. If you’re using the team 2 scope to deploy, then it wouldn’t have access to control a domain owned by team 1.