‼️ NOTICE: `aws:asset:original-path` is non deterministic
See original GitHub issueWhat is the problem?
Since 1.134.0, a Function
generates the metadata entry aws:asset:original-path
which includes the absolute path of the asset to be deployed. This information is system-dependent and therefore results in non-deterministic outputs.
Please add your +1 👍 to let us know you have encountered this
Workaround
Use --no-asset-metadata
or set assetMetadata: false
in your cdk.json
.
Status: IN PROGRESS
Original Issue
Since 1.134.0, a Function
is starting to generate the metadata entry aws:asset:original-path
which relies on the full path of the asset to be deployed, but the path is definitely depending on the executor environment.
I guess the relating change would be this.
Let’s say we defined a Function
construct like following:
new lambda.Function(this, 'NiceFunction', {
functionName: 'nice-function',
runtime: lambda.Runtime.RUBY_2_7,
code: lambda.Code.fromAsset(path.join(path.resolve(__dirname, '..'), 'lambda', 'nice_function')),
handler: 'app.LambdaFunctions::NiceFunction.process',
timeout: cdk.Duration.seconds(60),
role: someRole
});
Then, if the source script path would be /path/to/my-cdk/lib/my-stack.ts
then the aws:asset:original-path
would be /path/to/my-cdk/lambda/nice_function
.
But when another operator tries to deploy this stack, and if the source script path located on /foo/bar/my-cdk/lib/my-stack.ts
then the aws:asset:original-path
would claim it as/foo/bar/my-cdk/lambda/nice_function
…
So we always face the differences when different operator hits cdk diff
and even make a deployment when hitting cdk deploy
.
It’s very annoying…
Reproduction Steps
Create a stack containing a construct I described in “What is the problem?” section and hit cdk diff
.
What did you expect to happen?
No differences appear unless we made changes in the stack.
What actually happened?
So we almost always face the “differences” when different operators hit cdk diff
and even make a deployment when hitting cdk deploy
.
CDK CLI Version
1.134.0
Framework Version
No response
Node.js Version
v16.6.1
OS
macOS 11.6.1 (20G224)
Language
Typescript
Language Version
No response
Other information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:13 (8 by maintainers)
Top GitHub Comments
Thanks for the thorough report @issei-m
Before this gets fixed up, you can override your function’s metadata with the use of escape hatches
@rix0rrr pinging for visibility
@peterwoodworth I am tagging this as P0 since it’s breaking customers.