Believe this to demonstrate some strange behaviour with the CDK where the following mechanisms intersect:
@aws-cdk/aws-lambda-nodejs.NodejsFunction@aws-cdk/core.Stage- the
-e(exclusive) flag to thesynthordeploycommands
Branches:
main, broken behaviour. Combines the above three mechanisms, asset becomes a zip of the entire project root, rather than an../asset.[hash]pathno-cdk-stage, expected behivour. Remove use of aStage, attach the stack directly to theApp. Asset path is as expected.non-nodejs-lambda-fn, expected behaviour. RemoveNodejsFunctionand use a regularFunctioninstead. Asset path is as expected.do-not-synth-exclusive, expected behaviour. Remove the-eflag from thesynthcommand. Asset path is as expected.- (possibly unrelated):
spurious-yarn-lock, broken behaviour. Add ayarn.lockin a parent on the project root. Asset path is now a zip of the parent of the project root. I think this is because it is looking for ayarn.lockfirst, and this is just a knock-on effect of the issue.
Method (See the check.sh script):
- Runs the
synthcommand, then looks in the assets manifest - Checks if that references the absolute path to the directory
root. If so, asserts that something strange and wrong has happened,
as would expect the asset to be
../asset[hash].