MCPcopy Create free account
hub / github.com/vercel/vercel / createDeploy

Function createDeploy

packages/cli/src/util/deploy/create-deploy.ts:11–129  ·  view source on GitHub ↗
(
  client: Client,
  now: Now,
  contextName: string,
  path: string,
  createArgs: CreateOptions,
  org: Org,
  isSettingUpProject: boolean,
  archive?: ArchiveFormat
)

Source from the content-addressed store, hash-verified

9import type { ArchiveFormat, DeploymentError } from '@vercel/client';
10
11export default async function createDeploy(
12 client: Client,
13 now: Now,
14 contextName: string,
15 path: string,
16 createArgs: CreateOptions,
17 org: Org,
18 isSettingUpProject: boolean,
19 archive?: ArchiveFormat
20): Promise<any | DeploymentError> {
21 try {
22 return await now.create(path, createArgs, org, isSettingUpProject, archive);
23 } catch (err: unknown) {
24 if (ERRORS_TS.isAPIError(err)) {
25 if (err.code === 'rate_limited') {
26 throw new ERRORS_TS.DeploymentsRateLimited(err.message);
27 }
28
29 // Means that the domain used as a suffix no longer exists
30 if (err.code === 'domain_missing') {
31 throw new ERRORS_TS.DomainNotFound(err.value);
32 }
33
34 if (err.code === 'domain_not_found' && err.domain) {
35 throw new ERRORS_TS.DomainNotFound(err.domain);
36 }
37
38 // This error occures when a domain used in the `alias`
39 // is not yet verified
40 if (err.code === 'domain_not_verified' && err.domain) {
41 throw new ERRORS_TS.DomainNotVerified(err.domain);
42 }
43
44 // If the domain used as a suffix is not verified, we fail
45 if (err.code === 'domain_not_verified' && err.value) {
46 throw new ERRORS_TS.DomainVerificationFailed(err.value);
47 }
48
49 // If the domain isn't owned by the user
50 if (err.code === 'not_domain_owner') {
51 throw new ERRORS_TS.NotDomainOwner(err.message);
52 }
53
54 if (err.code === 'builds_rate_limited') {
55 throw new ERRORS_TS.BuildsRateLimited(err.message, {
56 ctaLabel: err.ctaLabel,
57 ctaUrl: err.ctaUrl,
58 action: err.action,
59 link: err.link,
60 });
61 }
62
63 // If the user doesn't have permissions over the domain used as a suffix we fail
64 if (err.code === 'forbidden') {
65 throw new ERRORS_TS.DomainPermissionDenied(err.value, contextName);
66 }
67
68 if (err.code === 'bad_request' && err.keyword) {

Callers 2

handleInitDeploymentFunction · 0.85
handleDefaultDeployFunction · 0.85

Calls 3

generateCertForDeployFunction · 0.85
mapCertErrorFunction · 0.85
createMethod · 0.45

Tested by

no test coverage detected