Skip to content

Commit d6b4b40

Browse files
authored
fix(cloud9): use different debugger args for Python image lambdas #2870
1 parent 2f3d2a5 commit d6b4b40

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Debugging Python image-based lambdas fails with `Init failed error=exec: \"-m\": executable file not found`"
4+
}

src/shared/sam/cli/samCliInvokerUtils.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,5 @@ export function logAndThrowIfUnexpectedExitCode(processResult: ChildProcessResul
5656
}
5757
}
5858

59-
if (!message) {
60-
message = processResult.stderr || processResult.stdout || 'No message available'
61-
}
62-
63-
throw makeUnexpectedExitCodeError(message)
59+
throw makeUnexpectedExitCodeError(message ?? 'no message available')
6460
}

src/shared/sam/debugger/pythonSamDebug.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,14 @@ export async function makePythonDebugConfig(
138138
// --ikpdb-protocol=vscode:
139139
// For https://github.com/cmorisse/vscode-ikp3db
140140
// Requires ikp3db 1.5 (unreleased): https://github.com/cmorisse/ikp3db/pull/12
141-
config.debugArgs = [
142-
`-m ikp3db --ikpdb-address=0.0.0.0 --ikpdb-port=${config.debugPort} -ik_ccwd=${ccwd} -ik_cwd=/var/task ${logArg}`,
143-
]
141+
const debugArgs = `-m ikp3db --ikpdb-address=0.0.0.0 --ikpdb-port=${config.debugPort} -ik_ccwd=${ccwd} -ik_cwd=/var/task ${logArg}`
142+
143+
if (isImageLambda) {
144+
const params = getPythonExeAndBootstrap(config.runtime)
145+
config.debugArgs = [`${params.python} ${debugArgs} ${params.bootstrap}`]
146+
} else {
147+
config.debugArgs = [debugArgs]
148+
}
144149
}
145150

146151
manifestPath = await makePythonDebugManifest({

0 commit comments

Comments
 (0)