Bug: empty '.aws-sam/cache' directory after running sam build --cache
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Description:
According to [sam cli documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html), the directory where the cache artifacts are stored when --cached is specified. The default cache directory is .aws-sam/cache.
However, in my testing, it seems that the `.aws-sam/cache` is always empty. Curious what's the purpose of this directory and when would it be non-empty?
### Steps to reproduce:
I defined the following `template.yaml` file. This is the template I use, but I believe any template would work to reproduce this issue.
```
Transform:
- AWS::Serverless-2016-10-31
Parameters:
Policy:
Type: String
Default: Delete
Resources:
VerificationQueue:
UpdateReplacePolicy: !Ref Policy
DeletionPolicy: !Ref Policy
Type: AWS::SQS::Queue
TriggerFunction:
Type: AWS::Serverless::Function
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.8
CodeUri: my-lambda-function/
```
Here is my handler/codeuri setup.
```
my-lambda-function/
├── lambda_function.py
└── requirements.txt
```
Now running `sam build --cached --beta-features` will generates `.aws-sam` directory.
### Observed result:
`.aws-sam/cache` does not have any content, which is different from what the documentation mentioned.
### Expected result:
Expect to see cache artifacts in this directory.
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: MacOs Ventura 13.5.2 (22G91)
2. `sam --version`: SAM CLI, version 1.98.0
3. AWS region: us-west-2
```
{
"version": "1.98.0",
"system": {
"python": "3.8.13",
"os": "macOS-13.5.2-x86_64-i386-64bit"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "2.89.0 (build 2ad6683)",
"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
Assessment
This issue has not been assessed yet.