aws / aws/aws-sam-cli

SAM Build error: NodejsNpmBuilder:NpmPack raised unhandled exception

Open
#7,503 4 comments 0 reactions 0 assignees View on GitHub
area/build area/node-npm
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

Since version 1.124.0 I can no longer build an aws sam template with a lambda function inside in nodejs

log:

> Running workflow 'NodejsNpmBuilder'
> 2024-09-23 14:17:50,494 | Running NodejsNpmBuilder:NpmPack
> 2024-09-23 14:17:50,495 | NODEJS packaging file:C:\......\.aws-dist to C:\Users\\AppData\Local\Temp\tmpr_e2iwel
> 2024-09-23 14:17:50,497 | executing NPM: ['npm.cmd', 'pack', '-q', 'file:C:\\...\\.aws-dist']
> 2024-09-23 14:17:52,527 | NODEJS packed to -api-1.4.4.tgz
> 2024-09-23 14:17:52,528 | NODEJS extracting to C:\Users\\AppData\Local\Temp\tmpr_e2iwel\unpacked
> 2024-09-23 14:17:52,530 | NodejsNpmBuilder:NpmPack raised unhandled exception
> Traceback (most recent call last):
> File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\aws_lambda_builders\workflow.py", line 374, in run
> action.execute()
> File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\aws_lambda_builders\workflows\nodejs_npm\actions.py",
> line 68, in execute
> extract_tarfile(tarfile_path, self.artifacts_dir)
> File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\aws_lambda_builders\utils.py", line 230, in
> extract_tarfile
> with tarfile.open(tarfile_path, "r:*") as tar:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "tarfile.py", line 1835, in open
> File "tarfile.py", line 1903, in gzopen
> File "gzip.py", line 192, in __init__
> FileNotFoundError: [Errno 2] No such file or directory:
> 'C:\\Users\\M9A61~1.PET\\AppData\\Local\\Temp\\tmpr_e2iwel\\livesign-api-1.4.4.tgz'

I can't put the whole project as an example but if needed I can create a simpler one to see if the problem persists.

I installed the previous version of sam 1.123.0 and the problem does not occur

1. OS: Win 11
2. `sam --version`: SAM CLI, version 1.124.0
3. AWS region: eu-south-1

```
{
"version": "1.124.0",
"system": {
"python": "3.12.6",
"os": "Windows-11-10.0.22631-SP0"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.