diff --git a/lib/coolify.ts b/lib/coolify.ts index 0e48d4c..35d3af7 100644 --- a/lib/coolify.ts +++ b/lib/coolify.ts @@ -429,8 +429,18 @@ export async function listApplications(): Promise { return coolifyFetch('/applications'); } -export async function deployApplication(uuid: string): Promise<{ deployment_uuid: string }> { - return coolifyFetch(`/applications/${uuid}/deploy`, { method: 'POST' }); +export async function deployApplication(uuid: string, opts: { force?: boolean } = {}): Promise<{ deployment_uuid: string }> { + // Coolify v4 exposes deploy as POST /deploy?uuid=...&force=... + // The older /applications/{uuid}/deploy path is a 404 on current + // Coolify releases. + const q = new URLSearchParams({ uuid }); + if (opts.force) q.set('force', 'true'); + const res = await coolifyFetch(`/deploy?${q.toString()}`, { method: 'POST' }); + // Response shape: { deployments: [{ deployment_uuid, ... }] } or direct object. + const first = Array.isArray(res?.deployments) ? res.deployments[0] : res; + return { + deployment_uuid: first?.deployment_uuid ?? first?.uuid ?? '', + }; } export async function getApplication(uuid: string): Promise {