Closed
Description
What is the problem?
After updating Amazon.CDK.Lib from 2.3.0 to 2.12.0 the LambdaInvokeAction fails to synthesize.
Reproduction Steps
Run CDK synth of the following code:
var changeVersionLambda = Function.FromFunctionArn(this, "changeVersionLambda", changeVersionLambdaArn);
new Amazon.CDK.AWS.CodePipeline.StageProps
{
StageName = "Deploy_Test",
Actions = new IAction[]
{
new LambdaInvokeAction(new LambdaInvokeActionProps() {
ActionName = "Populate_Parameters",
Lambda = changeVersionLambda,
UserParameters = new Dictionary<string, object>
{
["component"] = "service",
["environment"] = PlatformEnvironment.Test.ToString(),
["version"] = nodeServiceBuildAction.Variable("NEW_VERSION")
}
})
}
}
What did you expect to happen?
CDK synth executes successfully.
What actually happened?
CDK synth fails.
Exception: Amazon.JSII.Runtime.JsiiException: The 'account' property must be a concrete value (action: 'Populate_Version_Parameters')
CDK CLI Version
2.12.0
Framework Version
No response
Node.js Version
v14.17.0
OS
Windows
Language
.NET
Language Version
No response
Other information
No response
Activity
skinny85 commentedon Feb 18, 2022
Hey @Nemanjalj66,
thanks for opening the issue. I assume this is because #18255 was one of the changes that got merged between
2.3.0
and2.12.0
.Is your pipeline in the same account as the Function you're importing with
Function.FromFunctionArn()
?github-actions commentedon Feb 20, 2022
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Nemanjalj66 commentedon Feb 21, 2022
Hey @skinny85,
thanks for the response.
Yes, it is in the same account.
skinny85 commentedon Feb 21, 2022
OK, that's good. That means you should be able to unblock yourself by specifying the account (and probably region) of the pipeline Stack to the same values as are present in the Lambda function's ARN.
However, long-term, I think we should introduce a
Function.fromFunctionName()
method that allows you to skip all of this dance, and just always assumes the Function is in the same account and region you are importing it to.21 remaining items