Bug: Cache not invalidating
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Description:
Currently using golang for setup. If any code change is made in the handler the cache is invalidated. However if a local package in the same repo is updated which is being used in lambda handler this change does not invalidate the cache. This also does not trigger a change for sam sync --watch either.
Based off the docs on the cache flag I noticed the following
> AWS SAM doesn't evaluate whether you've changed third-party modules that your project depends on, where you haven't provided a specific version. For example, if your Python function includes a requirements.txt file with the entry requests=1.x, and the latest request module version changes from 1.1 to 1.2, then AWS SAM doesn't pull the latest version until you run a non-cached build.
I would understand this would be an issue with external packages however local packages I would expect this to not be an issue. If you were to run a go build it would trigger a new artifact. Example repo: https://github.com/dgocoder/full-stack-serverless-monorepo
### Steps to reproduce:
File structure
- cmd/lambda/main.go
- internal/some-package/test.go
main.go lambda handler calls a function in test.go file. If a change in that file is made cache is not invalidated nor is sam sync triggered. Happy to provide sample repo if needed.
### Observed result:
sam build --cached does not invalidate cache when a change is made to a local package
sam sync --watch does not also trigger an update
### Expected result:
I would expect sam build --cached would invalidate cache for local packages.
I would also expect sam sync --watch to trigger updates on local packages.
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: Mac Ventura
2. `sam --version`: SAM CLI, version 1.72.0
3. AWS region: us-east-2
```
{
"version": "1.72.0",
"system": {
"python": "3.11.1",
"os": "macOS-13.2-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "20.10.22",
"aws_cdk": "Not available",
"terraform": "Not available"
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.