Skip to content

PagesDeployment

Source: src/Cloudflare/Pages/Deployment.ts

A direct-upload deployment on a Cloudflare Pages project.

Creating the resource POSTs a new deployment to the project and waits (bounded) for it to reach a successful deploy stage. Deployments are immutable — every prop change triggers a replacement (a brand-new deployment that supersedes the previous one).

The deployment is created with an empty asset manifest: the full direct-upload protocol (asset upload sessions driven by wrangler pages deploy) is not part of the public REST surface, so this resource cannot push file contents. It is useful for provisioning an initial/placeholder deployment on a direct-upload project (so the project’s *.pages.dev subdomain starts serving) and for rolling the active deployment from IaC. For deploying real static sites prefer Cloudflare.Website (Workers Assets).

Deleting the resource deletes the deployment (with force), except when it is the project’s active production deployment — Cloudflare refuses to delete the live deployment, so delete tolerates that case and the deployment is cleaned up when the project itself is deleted.

Production deployment on a direct-upload project

const project = yield* Cloudflare.PagesProject("site", {});
const deployment = yield* Cloudflare.PagesDeployment("site-deploy", {
projectName: project.name,
});
// deployment.url === "https://<shortId>.<project>.pages.dev"
// deployment.environment === "production"

Preview deployment from a non-production branch

const preview = yield* Cloudflare.PagesDeployment("site-preview", {
projectName: project.name,
branch: "feature-x",
});
// preview.environment === "preview"