Domain assignment using Vercel Endpoint shown "No Deployment"

I have scenario:

  • user create their own subdomain/domain
  • assign to our project vercel using Vercel Endpoint (/v10/projects/${config.projectId}/domains)
  • Vercel domain page show expected result, domain assigned successfully.

But, it show No Deployment warning.

I expect this process assigned automatically without require to re-deploy.

This is my code to build up the request to vercel endpoint

    const vercelApiUrl =
      `${this.vercelApi}/v10/projects/${config.projectId}/domains?teamId=${config.teamId}`;
    const vercelApiBody = {
      name: domain,
      gitBranch: process.env.VERCEL_DOMAIN_GITBRANCH,
    };

I have some question:

  1. If this flow require re-deploy, what API should I use to re-deploy latest deployment of selected branch?
  2. If this scenario can achive without re-deploy, how I to do it using Vercel Endpoint API?
  3. How do I purge cache using Vercel Endpoint API?

Hi, @unity-admin! Welcome to the Vercel Community :smile:

Thanks for your patience and providing detailed context!

Question for you: what are you building? This is a unique scenario, not heard of this before.

Would love to hear if you’ve made any breakthroughs since posting this, I’ll answer your question anyway in case anyone else comes across this thread in the future.

You can use the Vercel CLI command vercel --prod to create a production deployment of the latest changes from your specified branch to re-deploy.

Typically, assigning a domain to a project shouldn’t require a re-deploy if the domain is correctly configured. The API endpoint you’re using (/v10/projects/${config.projectId}/domains) is correct for assigning a domain to a project. However, the “No Deployment” warning you’re seeing suggests that there might be an issue with the deployment or domain configuration.

To resolve this without a re-deploy, you could try:

  1. Verifying that the gitBranch specified in your API request matches a branch with an existing deployment.
  2. Checking if there are any DNS configuration issues for the domain.
  3. Ensuring that the domain has been properly verified in your Vercel project settings.

Regarding cache purging, Vercel doesn’t provide a direct API endpoint for purging cache. Cache management in Vercel is typically handled through cache-control headers in your application.

Let us know how you get on!

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