aws / aws/aws-toolkit-vscode

SAM debug fails with layer BuildMethod:makefile

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

Description

**Describe the bug**

I have a sam application, which has a python lambda function. This lambda function depends on a lambda layer. This layer has a BuildMethod: makefile in its template.yaml definition.
The sam applications builds fine with sam build and can be deployed to AWS and works correctly after being deployed.
However, when I attempt to debug this lambda function locally using vscode, the sam build step fails with "Make Failed: make: *** No rule to make target" error.
During the investigation I executed the statements, which debugger executes manually with --debug switch and compared their output to the regular sam build output.

The correctly executed make statement looks like this:
executing Make: ['make', '--makefile', '/home/test/work/projects/testproject/lambda/shareddepslayer/Makefile', 'build-shareddepslayer']

While the make statement, executed during the debug build is this:
executing Make: ['make', '--makefile', '/tmp/aws-toolkit-vscode/vsctkQvLSJf/debug-requirements.txt', 'build-shareddepslayer']

This suggests that vscode SAM debug build process wrongfully takes a manifest file as a parameter for make instead of Makefile.

**To Reproduce**

1. Create a SAM application with a python lambda function, which depends on the layer
2. Layer shall use BuildMethod: makefile
3. Add Debug Configuration for this function to launch.json
4. Start debugging

**Expected behavior**

SAM build shall succeed and debugging session shall start properly

**Desktop (please complete the following information):**

OS: Linux x64 4.19.128-microsoft-standard
Visual Studio Code Extension Host Version: 1.52.1
AWS Toolkit Version: 1.18.0

Contributor guide

Open the contributing guide

Research direction

Reproduce the VS Code SAM debug build using the template.yaml layer with BuildMethod: makefile, its Makefile, and the launch.json debug configuration. Compare the failing debug command with the successful sam build command, then trace where the debug build selects debug-requirements.txt instead of Makefile. Done means the build uses the layer Makefile and the local debugging session starts successfully.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.