From ea5d60352d32baf50b4fa6da3b883717ba91c1a8 Mon Sep 17 00:00:00 2001 From: mulahasanovic Date: Thu, 14 May 2026 10:45:40 +0200 Subject: [PATCH] fix(debug): send _debug=128 via URL for runAsTask debug, drop _omittextlog --- src/job-execution/JobExecutor.ts | 8 +------ src/job-execution/WebJobExecutor.ts | 33 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/job-execution/JobExecutor.ts b/src/job-execution/JobExecutor.ts index f9c9944..955611c 100644 --- a/src/job-execution/JobExecutor.ts +++ b/src/job-execution/JobExecutor.ts @@ -55,13 +55,7 @@ export abstract class BaseJobExecutor implements JobExecutor { if (config.debug) { requestParams['_omittextlog'] = 'false' requestParams['_omitSessionResults'] = 'false' - - requestParams['_debug'] = - config.useComputeApi === null && - config.serverType === ServerType.SasViya && - config.runAsTask === true - ? 128 - : 131 + requestParams['_debug'] = 131 } return requestParams diff --git a/src/job-execution/WebJobExecutor.ts b/src/job-execution/WebJobExecutor.ts index d4e8f25..545e8a4 100644 --- a/src/job-execution/WebJobExecutor.ts +++ b/src/job-execution/WebJobExecutor.ts @@ -123,6 +123,22 @@ export class WebJobExecutor extends BaseJobExecutor { // _executionTasks=true. Dummy file keeps the body non-empty const hasExecutionTasksFlag = config.runAsTask === true + // Move debug params to URL for viya; viya seems to honor them more + // reliably in the query string than the multipart body. + if ( + hasExecutionTasksFlag && + config.debug && + config.serverType === ServerType.SasViya + ) { + const debugKeys = ['_debug', '_omitSessionResults'] + debugKeys.forEach((key) => { + if (requestParams[key] !== undefined) { + apiUrl += `&${key}=${encodeURIComponent(requestParams[key])}` + delete requestParams[key] + } + }) + } + if (data) { const stringifiedData = JSON.stringify(data) if ( @@ -255,6 +271,23 @@ export class WebJobExecutor extends BaseJobExecutor { return requestPromise } + protected getRequestParams(config: any): any { + const requestParams = super.getRequestParams(config) + + // FIXME(viya - possible issue with default debug flags) + // runAsTask on Viya: use _debug=128 (not 131) and omit _omittextlog + if ( + config.debug && + config.serverType === ServerType.SasViya && + config.runAsTask === true + ) { + requestParams['_debug'] = 128 + delete requestParams['_omittextlog'] + } + + return requestParams + } + private async getJobUri(sasJob: string) { if (!this.sasViyaApiClient) return '' let uri = ''