From 43259b378c28e10e6cb95537a1e3afe377ddf21a Mon Sep 17 00:00:00 2001 From: Yashas Date: Tue, 25 Aug 2026 13:46:51 +0530 Subject: [PATCH] fix(upload): always send workflow_uuid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /upload requires it and it is fixed for this app, but the client only appended it when ctx happened to carry it — and FileField passes only activity, field and instance. Every upload came back 400 with "Missing required params: workflow_uuid". Taken from config now, so it cannot be forgotten by a caller. Co-Authored-By: Claude Opus 5 (1M context) --- src/api/client.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/api/client.js b/src/api/client.js index cd520b0..3651599 100644 --- a/src/api/client.js +++ b/src/api/client.js @@ -179,10 +179,14 @@ export class ZinoClient { async uploadFile(file, ctx) { const form = new FormData() form.append('file', file) - if (ctx.workflowUuid) form.append('workflow_uuid', ctx.workflowUuid) - if (ctx.activityId) form.append('activity_id', ctx.activityId) - if (ctx.fieldId) form.append('field_id', ctx.fieldId) - if (ctx.instanceId) form.append('instance_id', String(ctx.instanceId)) + // workflow_uuid is REQUIRED and is fixed for this app, so it is taken from + // config rather than from ctx. Passing it optionally is how the first + // version shipped: the upload sent activity_id, field_id and instance_id + // and got back `Missing required params: workflow_uuid`. + form.append('workflow_uuid', WORKFLOW) + if (ctx.activityId) form.append('activity_id', ctx.activityId) + if (ctx.fieldId) form.append('field_id', ctx.fieldId) + if (ctx.instanceId) form.append('instance_id', String(ctx.instanceId)) const headers = {} if (this.token) headers['Authorization'] = `Bearer ${this.token}` const res = await fetch(`${this.baseUrl}/app/${APP_ID}/upload`, { method: 'POST', headers, body: form })