Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
WC-5233 Use PATCH APIs for wrangler preview secret put and delete
  • Loading branch information
podonnell-dev committed Aug 10, 2026
commit 863d56c4418bd8c1cd86995f29a56dd9ec57e18f
9 changes: 9 additions & 0 deletions .changeset/preview-secret-per-preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"wrangler": minor
---

Add `wrangler preview secret put` and `wrangler preview secret delete` for managing secrets on a named Worker Preview

These private-beta commands manage secrets on a single named Preview by creating a new Preview deployment from its latest one, without affecting production, other Previews, or the Worker's Previews base configuration.

The new deployment goes live at 100% immediately, and the command reports the live Preview URL on success.
25 changes: 25 additions & 0 deletions packages/deploy-helpers/src/preview/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,31 @@ export async function createPreviewDeployment(
);
}

export async function patchPreviewDeployment(
config: Config,
accountId: string,
workerName: string,
previewIdentifier: string,
env: Record<string, Binding | null>,
annotations?: {
"workers/message"?: string;
"workers/tag"?: string;
},
deploymentIdentifier = "latest"
): Promise<DeploymentResource> {
return fetchResult<DeploymentResource>(
config,
`/accounts/${accountId}/workers/workers/${workerName}/previews/${encodeURIComponent(
previewIdentifier
)}/deployments/${encodeURIComponent(deploymentIdentifier)}`,
{
method: "PATCH",
headers: { "Content-Type": "application/merge-patch+json" },
body: JSON.stringify({ env, annotations }),
}
);
}

export async function getWorkerPreviewDefaults(
config: Config,
accountId: string,
Expand Down
Loading