aws / aws/aws-toolkit-vscode

missing SAM CLI shows confusing "invalid launch config" message

Open
#5,820 1 comment 0 reactions 0 assignees View on GitHub
bug lambda sam ux
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

## Problem

When trying to debug a lambda function locally, I get this error:
```
2024-10-21 11:27:00.811 [error] SamLaunchRequestError: Invalid launch configuration: Debug Configurations with an invoke target of "code" require a valid Lambda runtime value, expected one of [python3.7, python3.8, python3.9, dotnet6, java11, java17, java8.al2, go1.x, nodejs20.x, python3.10, java8, python3.11, python3.12, nodejs14.x, nodejs16.x, nodejs18.x] [BadLaunchConfig]
```

However, it doesn't matter which value do I set for `lambda.runtime`, it always returns the same error.

## Steps to reproduce the issue

1. Create a launch configuration file with the following values

```json
{
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "Invoke Lambda Function",
"invokeTarget": {
"target": "code",
"architecture": "x86_64",
"projectRoot": "${workspaceFolder}",
"lambdaHandler": "${fileBasenameNoExtension}.lambdaHandler"
},
"lambda": {
"runtime": "nodejs20.x",
"payload": {
"path": "${workspaceFolder}/__tests__/mocks/${fileDirname}/${fileBasenameNoExtension}.json"
},
"environmentVariables": {}
}
}
]
}
```

2. Execute "Start" button

## Expected behavior

It should execute correctly, as `nodejs20.x` is a valid `runtime` value.

## System details (run `AWS: About` and/or `Amazon Q: About`)

- OS: Microsoft Windows 11 Pro (Version 10.0.22631 Build 22631)
- Visual Studio Code version: 1.94.2
- AWS Toolkit version: 3.29.0

Contributor guide

Open the contributing guide

Research direction

Reproduce the direct-invoke configuration from the issue in VS Code and inspect the AWS Toolkit/SAM launch validation path when the Start button is used. Verify that a valid nodejs20.x runtime is accepted and that local Lambda debugging no longer reports the invalid launch configuration error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript, vscode
Domain
cloud, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.