Skip to content

Commit f94b359

Browse files
SAM: support SAM CLI version 1.x (#1169)
- Since SAM CLI 1.0 we can no longer assume PID=1 (because more processes are used to bootstrap the app in Docker). So use `processName=dotnet` instead of `processId=1`. "For VSCode there will (currently) always be single `dotnet` executable running." ref aws/aws-toolkit-jetbrains#1886 ref e1e6e5f ref 60a2eab Testing: - For each of SAM CLI 0.45.0, SAM CLI 1.0.0 - For each of nodejs12.x, python3.7, dotnet2.1 - Set the `aws.samcli.location` to point to new/old sam binary. - Verify that `Run Locally` works - Verify that `Debug Locally` works. With sam 0.45.0, the Toolkit pulls these Docker images: Fetching lambci/lambda:dotnetcore2.1 Docker container image Fetching lambci/lambda:nodejs12.x Docker container image Fetching lambci/lambda:python3.7 Docker container image With sam 1.0.0, the Toolkit pulls these Docker images: Fetching amazon/aws-sam-cli-emulation-image-dotnetcore2.1:latest Docker container image Fetching amazon/aws-sam-cli-emulation-image-nodejs10.x:latest Docker container image Fetching amazon/aws-sam-cli-emulation-image-nodejs12.x:latest Docker container image Fetching amazon/aws-sam-cli-emulation-image-python3.7:latest Docker container image Per aws/aws-sam-cli#2066 , the new docker images are named like: amazon/aws-sam-cli-build-image-<runtime> amazon/aws-sam-cli-emulation-image-<runtime> Notes: - Elected not to include `justMyCode:false` in the dotnet config. - In a test of nodejs12.x, saw this error (transient, went away after retry): docker.errors.ImageNotFound: 404 Client Error: Not Found ("No such image: amazon/aws-sam-cli-emulation-image-nodejs12.x:latest") Co-authored-by: Hunter Werlla <[email protected]>
1 parent 72c9893 commit f94b359

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "support SAM CLI version 1.x"
4+
}

src/lambda/local/debugConfiguration.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface PythonDebugConfiguration extends DebugConfiguration {
4343

4444
export interface DotNetCoreDebugConfiguration extends DebugConfiguration {
4545
type: 'coreclr'
46-
processId: string
46+
processName: string
4747
pipeTransport: PipeTransport
4848
windows: {
4949
pipeTransport: PipeTransport
@@ -80,7 +80,9 @@ export function makeCoreCLRDebugConfiguration({
8080
name: 'SamLocalDebug',
8181
type: 'coreclr',
8282
request: 'attach',
83-
processId: '1',
83+
// Since SAM CLI 1.0 we cannot assume PID=1. So use processName=dotnet
84+
// instead of processId=1.
85+
processName: 'dotnet',
8486
pipeTransport: {
8587
pipeProgram: 'sh',
8688
pipeArgs,

src/shared/sam/cli/samCliValidator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { SamCliInfoInvocation, SamCliInfoResponse } from './samCliInfo'
1010
import { SamCliProcessInvoker } from './samCliInvokerUtils'
1111

1212
export const MINIMUM_SAM_CLI_VERSION_INCLUSIVE = '0.38.0'
13-
export const MAXIMUM_SAM_CLI_VERSION_EXCLUSIVE = '0.60.0'
13+
export const MAXIMUM_SAM_CLI_VERSION_EXCLUSIVE = '2.0.0'
1414

1515
// Errors
1616
export class InvalidSamCliError extends Error {

0 commit comments

Comments
 (0)