Fix workspace deletion — use build transition API
Publish Image / publish (push) Successful in 35s

The plain DELETE endpoint returns 405 for stopped workspaces. Use
POST /workspaces/:id/builds with {"transition":"delete"} instead,
which is the correct Coder API for workspace deletion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel Samson
2026-04-12 15:51:24 +01:00
co-authored by Claude Opus 4.6
parent 66649022ca
commit 0812a9be37
+4 -2
View File
@@ -109,12 +109,14 @@ export class CoderClient {
async deleteWorkspace(workspaceId: string): Promise<void> {
const res = await fetch(
`${this.baseUrl}/api/v2/workspaces/${workspaceId}`,
`${this.baseUrl}/api/v2/workspaces/${workspaceId}/builds`,
{
method: "DELETE",
method: "POST",
headers: {
"Content-Type": "application/json",
"Coder-Session-Token": this.token,
},
body: JSON.stringify({ transition: "delete" }),
},
);