diff --git a/src/job-execution/JobExecutor.ts b/src/job-execution/JobExecutor.ts index 4a61250..f9c9944 100644 --- a/src/job-execution/JobExecutor.ts +++ b/src/job-execution/JobExecutor.ts @@ -60,7 +60,7 @@ export abstract class BaseJobExecutor implements JobExecutor { config.useComputeApi === null && config.serverType === ServerType.SasViya && config.runAsTask === true - ? 'log' + ? 128 : 131 } diff --git a/src/utils/parseViyaLogDebugResponse.ts b/src/utils/parseViyaLogDebugResponse.ts index 0dfe20e..9060c9c 100644 --- a/src/utils/parseViyaLogDebugResponse.ts +++ b/src/utils/parseViyaLogDebugResponse.ts @@ -2,7 +2,7 @@ import { getValidJson } from './getValidJson' import { parseWeboutResponse } from './parseWeboutResponse' /** - * When querying a Viya job using the Web approach with _DEBUG=log (used when + * When querying a Viya job using the Web approach with _DEBUG=128 (used when * runAsTask is true), the webout JSON is inlined into the response via: * var blob = new Blob([`{...}`], {type: 'application/json'}); * On abort/error paths the same shape is used but with text/plain and @@ -10,7 +10,12 @@ import { parseWeboutResponse } from './parseWeboutResponse' * var blob = new Blob([`>>weboutBEGIN<<\n{...}\n>>weboutEND<<\n`], {type: 'text/plain'}); * No follow-up request is needed — extract and parse the JSON directly. */ -export const parseSasViyaLogDebugResponse = async (response: string) => { +export const parseSasViyaLogDebugResponse = async (response: any) => { + // If upstream already parsed the response as JSON (object), pass through. + if (typeof response !== 'string') { + return response + } + const blobMatch = response.match( /new Blob\(\[`([\s\S]*?)`\],\s*\{type:\s*'(?:application\/json|text\/plain)'\}\)/ )