question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

‼️ NOTICE: `aws:asset:original-path` is non deterministic

See original GitHub issue

What 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:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
peterwoodworthcommented, Nov 26, 2021

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

1reaction
eladbcommented, Dec 8, 2021

@peterwoodworth I am tagging this as P0 since it’s breaking customers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my SQL function non-deterministic, when it shouldn't be?
Implicitly converting a varchar to a datetime , however, is not. This is especially worse when the format you use is ambiguous for...
Read more >
Non-determinism and sequence points in C - Gallium
Notice that non-determinism in C is even more unrestrained than some may think. That the evaluation order in e1 + e2 is unspecified, ......
Read more >
nondeterministic computation in nLab
A fundamental example of non-deterministic computation is quantum computation, where the process of quantum measurement produces outcomes that – ...
Read more >
Trace and Testing Metrics on Nondeterministic Probabilistic ...
In this paper, we consider nondeterministic probabilistic labeled ... Notice that, since we consider image finite processes, we are guaranteed that for each ......
Read more >
Nondeterministic Operators in Algebraic Frameworks
The use of nondeterministic operators is an appropriate and useful abstraction tool, ... Notice that the last axiom ensures singular semantics.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found