diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index a0bef7ac0a..af9dd3ed56 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -387,15 +387,31 @@ async function proxyRequestToAxios( axios(axiosConfig) .then((response) => { if (configObject.resolveWithFullResponse === true) { + let body = response.data; + if (response.data === '') { + if (axiosConfig.responseType === 'arraybuffer') { + body = Buffer.alloc(0); + } else { + body = undefined; + } + } resolve({ - body: response.data, + body, headers: response.headers, statusCode: response.status, statusMessage: response.statusText, request: response.request, }); } else { - resolve(response.data); + let body = response.data; + if (response.data === '') { + if (axiosConfig.responseType === 'arraybuffer') { + body = Buffer.alloc(0); + } else { + body = undefined; + } + } + resolve(body); } }) .catch((error) => { diff --git a/packages/core/src/WorkflowExecute.ts b/packages/core/src/WorkflowExecute.ts index 7ebe4dcda7..df84915d75 100644 --- a/packages/core/src/WorkflowExecute.ts +++ b/packages/core/src/WorkflowExecute.ts @@ -896,7 +896,11 @@ export class WorkflowExecute { // the `error` property. for (const execution of nodeSuccessData!) { for (const lineResult of execution) { - if (lineResult.json.$error !== undefined && lineResult.json.$json !== undefined) { + if ( + lineResult.json !== undefined && + lineResult.json.$error !== undefined && + lineResult.json.$json !== undefined + ) { lineResult.error = lineResult.json.$error as NodeApiError | NodeOperationError; lineResult.json = { error: (lineResult.json.$error as NodeApiError | NodeOperationError).message,