From 81c832b9a10f830d4d8520a877b6e48fedb147e6 Mon Sep 17 00:00:00 2001 From: Nadeesha Cabral Date: Tue, 26 Nov 2024 16:38:19 +1100 Subject: [PATCH] fix: Correct HTTP status code for blob upload --- sdk-node/src/service.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sdk-node/src/service.ts b/sdk-node/src/service.ts index ee761f88..89a2b135 100644 --- a/sdk-node/src/service.ts +++ b/sdk-node/src/service.ts @@ -205,7 +205,7 @@ export class Service { body: blob, }) .then(async (res) => { - if (res.status === 204) { + if (res.status === 201) { log("Uploaded blob", call.id, call.function); } else { throw new InferableError(`Failed to upload blob: ${res.status}`, { @@ -269,24 +269,26 @@ export class Service { }); } - const result = await executeFn( - registration.func, - [args, { + const result = await executeFn(registration.func, [ + args, + { authContext: call.authContext, runContext: call.runContext, approved: call.approved, - }], - ); + }, + ]); await onComplete(result); } } -export const registerMachine = async (client: ReturnType, +export const registerMachine = async ( + client: ReturnType, service?: { name: string; functions: FunctionRegistration[]; - }) => { + }, +) => { log("registering machine", { service: service?.name, functions: service?.functions.map((f) => f.name), @@ -319,5 +321,4 @@ export const registerMachine = async (client: ReturnType return { clusterId: registerResult.body.clusterId, }; -} - +};