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

Bug: Using AWS::Serverless::LayerVersion with BuildMethod: makefile and python runtime fails to build #566

Open
shanti-calleja-its opened this issue Nov 4, 2023 · 2 comments
Labels
area/build blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@shanti-calleja-its
Copy link

Description:

Using a template with AWS::Serverless::LayerVersion and BuildMethod: makefile fails building because tha makefile passed to make command seems wrong. The code aws_lambda_builders/workflows/custom_make/actions.py", line 99 is using variable manifest_path which is a dependency manifest not the makefile

Steps to reproduce:

template.yaml

AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A sample SAM template for deploying Lambda functions.

Resources:

LibsLayer:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: ../../layerlibs/
CompatibleRuntimes:
- python3.11
Metadata:
BuildMethod: makefile

/usr/local/bin/sam build --build-dir /tmp/aws-toolkit-vscode/vsctkChoBiG/output --template /home/user/github/LambdAtom/atom_vmaas/.vscode/template.yml --manifest /tmp/aws-toolkit-vscode/vsctkChoBiG/debug-requirements.txt --debug

Observed result:

2023-11-04 12:53:36,389 | CustomMakeBuilder:CopySource succeeded
2023-11-04 12:53:36,390 | LibsLayer: Running CustomMakeBuilder:MakeBuild
2023-11-04 12:53:36,391 | LibsLayer: Current Artifacts Directory : /tmp/aws-toolkit-vscode/vsctkChoBiG/output/LibsLayer
2023-11-04 12:53:36,392 | executing Make: ['make', '--makefile', '/tmp/aws-toolkit-vscode/vsctkChoBiG/debug-requirements.txt', 'build-LibsLayer']
2023-11-04 12:53:36,402 | CustomMakeBuilder:MakeBuild failed
Traceback (most recent call last):
File "aws_lambda_builders/workflows/custom_make/actions.py", line 99, in execute
File "aws_lambda_builders/workflows/custom_make/make.py", line 115, in run
aws_lambda_builders.workflows.custom_make.make.MakeExecutionError: Make Failed: make: *** No rule to make target 'build-LibsLayer'. Stop.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "aws_lambda_builders/workflow.py", line 371, in run
File "aws_lambda_builders/workflows/custom_make/actions.py", line 109, in execute
aws_lambda_builders.actions.ActionFailedError: Make Failed: make: *** No rule to make target 'build-LibsLayer'. Stop.

Build Failed

Expected result:

['make', '--makefile', '/home/user/github/LambdAtom/layerlibs/Makefile', 'build-LibsLayer']

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: WSL2 Debian
  2. If using SAM CLI, sam --version: SAM CLI, version 1.100.0
  3. AWS region: Local environment and eu-west-3

Add --debug flag to any SAM CLI commands you are running

@shanti-calleja-its shanti-calleja-its added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Nov 4, 2023
@hawflau
Copy link
Contributor

hawflau commented Nov 9, 2023

@shanti-calleja-its thanks for raising the issue.

Can you try not setting the --manifest option? It seems like it's overridden where to look up the Makefile.

@hawflau hawflau added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. area/build and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Nov 9, 2023
@shanti-calleja-its
Copy link
Author

I can build the app using sam commands using the template.

The problem happens when I try to use vscode debugger. The launch.json uses the template as expected creating the build dir, copying files and building the command as:

/usr/local/bin/sam build --build-dir /tmp/aws-toolkit-vscode/vsctkChoBiG/output --template /home/user/github/LambdAtom/atom_vmaas/.vscode/template.yml --manifest /tmp/aws-toolkit-vscode/vsctkChoBiG/debug-requirements.txt

The manifest is modified by debugger including debugpy for debugging.

From my point of view the problem is that the CustomMakeBuilder is trying to read the manifest as a makefile when --manifest is passed to the build command. If Idon´t use the arguments, it works, but debugging is not enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

2 participants