fix(coolify): use /deploy?uuid=... endpoint (Coolify v4)

Made-with: Cursor
This commit is contained in:
2026-04-21 12:07:12 -07:00
parent a591c55fc4
commit eacec74701

View File

@@ -429,8 +429,18 @@ export async function listApplications(): Promise<CoolifyApplication[]> {
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<CoolifyApplication> {