Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing SAM CLI shows confusing "invalid launch config" message #5820

Open
RaniAgus opened this issue Oct 21, 2024 · 1 comment
Open

missing SAM CLI shows confusing "invalid launch config" message #5820

RaniAgus opened this issue Oct 21, 2024 · 1 comment
Labels
bug We can reproduce the issue and confirmed it is a bug. lambda sam ux user experience

Comments

@RaniAgus
Copy link

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
{
  "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": {}
      }
    }
  ]
}
  1. 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
@RaniAgus RaniAgus added the bug We can reproduce the issue and confirmed it is a bug. label Oct 21, 2024
@RaniAgus
Copy link
Author

RaniAgus commented Oct 21, 2024

After some digging I found out that this could be due to not having installed the AWS SAM CLI 🤔
If so, the error message is incorrect.

@justinmk3 justinmk3 changed the title Unable to debug locally, incorrect error message missing SAM CLI shows confusing "invalid launch config" message Oct 21, 2024
@justinmk3 justinmk3 added the ux user experience label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug We can reproduce the issue and confirmed it is a bug. lambda sam ux user experience
Projects
None yet
Development

No branches or pull requests

2 participants