Ever had that moment when you think you’ve nailed it, only to find out you’re elbow-deep in a bucket of confusion at 3AM? Yeah, welcome to my world. Picture this: a perfectly orchestrated deploy via the Vercel API at the ungodly hour of 3AM Brisbane time, all sweet and successful—except for one sneaky little detail: the damn thing was now living its best life at some random .vercel.app URL instead of our trusty shoreagents.com. The fix? A not-so-simple API call that took me way longer to find than I care to admit. Spoiler alert: if you’re not careful, your production domain could end up doing some serious wandering.
The Setup: Why I Was Deploying at 3AM
Let's set the stage, shall we? It all started with a midnight epiphany fueled by caffeine and sheer stubbornness—Stephen and I were determined to get a new feature up for our users. We thought, "Hey, let’s use the Vercel API to manually deploy. What could go wrong?" Insert eye-roll here.
Stephen had just disconnected Git and tried to reconnect it—not sure why, but he swore it would help. Instead, it was akin to tossing a live grenade into the mix. Everything was running smoothly until it wasn’t. Here's how we rolled the dice:
`bash
curl -X POST https://api.vercel.com/v1/deployments \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "shoreagents",
"version": 1,
"meta": {
"description": "Deploying new feature at crazy hours"
},
"files": [
{
"file": "index.js",
"data": "console.log(\"Hello Vercel!\");"
}
]
}'
`
The Oops Moment: Domain Alias Dilemma
The deploy went through without any issues. I was already patting myself on the back—until I realized nobody could find our shiny new feature because it went AWOL on some random .vercel.app URL. Sure, it was live, but darling, this wasn’t the Hollywood premiere we were shooting for. I frantically checked the Vercel dashboard while sipping on my last cup of coffee like it was holy water.
_"Reina, you absolute muppet,"_ Stephen would later say with his signature Australian accent cut through the caffeine haze, _“You forgot to alias it to the domain! We're not just launching into the void!”_
I could feel the headache coming on. The Vercel API requires you to make a separate POST request to v2/deployments/{id}/aliases. This wasn’t documented clearly; thank you very much, Vercel. Normally, Vercel takes care of all this when you connect your Git provider, but the manual deploy? Nope, that’s on you, boo.
Finding the Fix: The Extra Call
After an exhausting 40 minutes of hunting through the Vercel docs and pacing like a lion in a cage, I finally found the missing jigsaw piece. What did I need? A simple POST to alias that baby to our production domain:
`bash
curl -X POST https://api.vercel.com/v2/deployments/YOUR_DEPLOYMENT_ID/aliases \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"alias": "shoreagents.com"
}'
`
The deployment ID, by the way, is something you snag right after your initial deploy call. I had it stored in my brain somewhere under layers of sleep deprivation.
The moment I hit enter on that command, I felt like I was finally releasing a breath I didn't know I was holding. Suddenly, shoreagents.com had the feature it deserved, and I could finally crawl into bed without feeling like I’d just run a marathon on a chain of broken code.
Lessons Learned: Know Your API
So, what’s the takeaway here? When you're playing with the Vercel API, always, and I mean ALWAYS, check the fine print. Manual deploys might save you some Gödel-like complex configurations, but they come with their own set of caverns to explore.
- 1.Always document your steps—or else you’ll spend an eternity looking for a needle in a haystack.
- 2.Pay attention to alias requirements. Auto-deploy might handle it all, but if you’re going rogue, keep your eyes peeled.
- 3.Communicate with your team. If someone's tinkering with Git in the middle of the deploy, check if they haven’t stirred some plot-devastating chaos.
FAQ
Q: What do I need to do to alias my deployment to a custom domain on Vercel? A: You need to make a separate API call to `v2/deployments/{id}/aliases` after your deploy request.
Q: What happens if I forget to alias my deployment? A: Your deployment will live at a random `.vercel.app` URL and will not reflect on your custom domain.
Q: Can I automate the aliasing process? A: Yes! You can script the alias call as part of your deployment process, but make sure you handle errors gracefully.
Q: Is there a way to check if the alias was set correctly? A: Yes! You can GET the deployment details and check the `aliases` field in the response.
Q: What’s the best practice for Vercel deployments at odd hours? A: Document every update and keep faithful notes like a diary of your coding adventures. Trust me, future you will thank you!
Remember, if you find yourself deploying at 3AM, bring snacks, a buddy, and a good sense of humor! Catch you later, code wizards!

