Deployment of main branch with preview environment?

I’m trying to set up a custom domain to use for testing and qa. I’d like it to have all of my preview environment variables so it connects to my qa database and not my production one (among other things). I’d like this to just follow along the main branch so it is always up to date with my production deployment. I’d like to run some automated processes against it.

Under domains, I have selected the domain I want to use, selected the “Preview” environment and selected the main branch. When I click “Save” I get an error saying “A preview domain should be assigned to a git branch or a redirect.”

The first question is: Is it possible to have a configuration like this?

If I use a different branch, it seems to save and work fine.

What’s additionally confusing is that if I go and edit this ^ deployment and select the main branch, it saves fine but ends up changing the environment back to production without telling me or any kind of warning. This seems like a UI bug.

Happy to provide any more information if that’s helpful.

Thanks in advance for any help

The domain troubleshooting guide can help with most custom domain configuration issues. You might be able to use that guide to solve it before a human is available to help you. Then you can come back here and share the answer for bonus points.

You can also use v0 to narrow down the possibilities.