Visual Studio Code can't detect AWS SAM CLI

77 Views Asked by At

-> Context I need to create, test and deploy AWS Lambda functions using Visual Studio Code. I have already met the prerequisites to setup everything and start:

  • I have installed Docker latest version.
  • I have installed AWS CLI and configure the profile credentials of my AWS account.
  • I have installed AWS SAM CLI (latest version according to AWS documentation).
  • I got the AWS Toolkit extension for VSCode.

I tried to detect the SAM CLI and also create a Lambda SAM Application from VSCode. It didn't detect the AWS SAM CLI, so I manually specify the location of the "sam.cmd" file in VSCode, but it kept getting errors. So far I'm having the same messages back and forward:

-> AWS Toolkit logs messages

  • [WARN]:samCliLocator: found invalid SAM CLI (VersionNotParseable):"Localaddress"
  • [INFO]: SAM CLI location (version: undefined): undefined
  • [WARN]: telemetry: invalid Metric: "sam_detect" emitted with result=Failed but without the reason property. Consider using .run() instead of .emit(), which will set these properties automatically. See https://github.com/aws/aws-toolkit-vscode/blob/master/docs/telemetry.md#guidelines
  • [INFO]: SAM CLI location (from settings): C:\Program Files\Amazon\AWSSAMCLI\bin
  • [WARN]: samCliLocator: found invalid SAM CLI (VersionNotParseable): C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd
  • [ERROR]: Error creating new SAM Application: 'Error: SAM CLI was not found [MissingSamCli]'

-> VSCode Messages Apparently, there seems to be a problem with the version I'm using (version 1.109.0), VSCode keep giving messages such as:

  • SAM CLI 1.85-1.86 has known issues on Windows (I have Windows 10), update SAM CLI.
  • Cannot find SAM CLI.

Is there something I missed? I didn't configure something properly? Any information and feedback would be great.

....................

1

There are 1 best solutions below

0
Justin M. Keyes On

This log message is a hint:

[WARN]:samCliLocator: found invalid SAM CLI (VersionNotParseable):"Localaddress"

As noted in this comment, AWS Toolkit depends on the result of sam --info to parse SAM CLI's version. Can you run this command and share the result?

"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" --info

It should look like this:

$ sam --info
{
  "version": "1.109.0",
  "system": {
    "python": "3.12.2",
    "os": "macOS-14.3.1-arm64-arm-64bit"
  },
  "additional_dependencies": {
    ...
  },
  "available_beta_feature_env_vars": [
    ...
  ]
}