Skip to content

vercel.deployments.createDeployment does not support preview environment #117

@ian

Description

@ian

The vercel.deployments.createDeployment does not support preview as a deployment type, only production and staging.

How to trigger a vercel deployment for a branch using the preview environment?

const response = await vercel.deployments.createDeployment({
  teamId: "vercel-org",
  requestBody: {
    name: "vercel-project",
    target: 'preview',
    gitSource: {
      type: 'github',
      ref: "feat/new-ui",
      repo: "my-repo",
      org: "my-org",
    },
  },
});

Errors with: Invalid request: target should be 'production', 'staging', or a custom environment identifier.

The type param does not support preview

/**
   * Either not defined, `staging`, `production`, or a custom environment identifier. If `staging`, a staging alias in the format `<project>-<team>.vercel.app` will be assigned. If `production`, any aliases defined in `alias` will be assigned. If omitted, the target will be `preview`.
   */
  target?: string | undefined;

https://github.com/vercel/sdk/blob/main/src/models/createdeploymentop.ts#L384

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions