Closed having-fun-serverless closed 1 month ago
Hi @having-fun-serverless thanks for raising the issue. As explained in https://github.com/aws/aws-sam-cli/issues/6835#issuecomment-2000527587, Lambda Builders does not include dev dependencies by default. Could you please try the workarounds mentioned in the comment?
Hi @having-fun-serverless thanks for raising the issue. As explained in aws/aws-sam-cli#6835 (comment), Lambda Builders does not include dev dependencies by default. Could you please try the workarounds mentioned in the comment?
Yep, I did just that. The workaround works, the problem is that it's not obvious, people can easily spend hours in understanding the failure.
Closing this issue as the logging has been updated.
Description:
My prepare script runs
husky
. When runningsam build
I'm getting a NpmPack error -After further investigation I found out that the culprit is this piece of code - https://github.com/aws/aws-lambda-builders/blob/bd8bd9e5143ab2a8e083086792a41ee01e50a3bd/aws_lambda_builders/workflows/nodejs_npm/actions.py#L60 It runs npm pack and pulls the last line which is supposed to be the packed file name, but
npm pack
appends to the last line also the error that husky produces in which it complaints it runs in a non git folder.As a workaround I added
husky > /dev/null 2>&1
to the prepare script.When running
npm pack
to simulate the issue I'm gettingSteps to reproduce:
Add
to your
package.json
Observed result:
Expected result:
Pack was successful, so I was expecting
NpmPack
to succeed as well. The only issue is the last line of the execution.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:1.113.0
eu-central-1