Skip to content

(lambda): grantInvoke errors when only specifying sourceArn condition #20146

@kjpgit

Description

@kjpgit

Describe the bug

This works in web console, but fails in cdk:

 func.grantInvoke(new iam.ServicePrincipal("apigateway.amazonaws.com").withConditions(
  { "ArnLike": { "aws:SourceArn": "arn:aws:execute-api:us-west-2:111111111111:*" } }
))

Expected Behavior

.

Current Behavior

TypeError: Cannot read properties of undefined (reading 'aws:SourceAccount')

Reproduction Steps

.

Possible Solution

give up on cdk and use web console

Additional Information/Context

No response

CDK CLI Version

2.22.0 (build 1db4b16)

Framework Version

No response

Node.js Version

.

OS

linux

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-lambdaRelated to AWS LambdabugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions