You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating multiple instances of a aws-logSubscriptionFilter for aws-lambdaFunction an error occurs. This is not the case using only a single instance. Same error occurs when using the .addSubscriptionFilter() method on the aws-logLogGroup directly.
Yep, you are right. Thanks for reporting. As a workaround to get yourself unstuck, you can make your own implementation of LambdaDestination which does not have the issue.
importiam= require('@aws-cdk/aws-iam');importlambda= require('@aws-cdk/aws-lambda');importlogs= require('@aws-cdk/aws-logs');import{Construct}from'@aws-cdk/core';/** * Use a Lamda Function as the destination for a log subscription */exportclassLambdaDestinationimplementslogs.ILogSubscriptionDestination{constructor(privatereadonlyfn: lambda.IFunction){}publicbind(scope: Construct,logGroup: logs.ILogGroup): logs.LogSubscriptionDestinationConfig{constarn=logGroup.logGroupArn;this.fn.addPermission('CanInvokeLambda',{principal: newiam.ServicePrincipal(`logs.amazonaws.com`),sourceArn: arn,// Using SubScription Filter as scope is okay, since every Subscription Filter has only// one destination.
scope
});return{arn: this.fn.functionArn};}}```
We used to scope the permission for calling it from CloudWatch Logs
under the Lambda. However, when it was used multiple times there
would be a name conflict.
Instead, scope the Permission under the SubscriptionFilter.
Fixes#4951.
…4975)
We used to scope the permission for calling it from CloudWatch Logs
under the Lambda. However, when it was used multiple times there
would be a name conflict.
Instead, scope the Permission under the SubscriptionFilter.
Fixes#4951.
When creating multiple instances of a
aws-log
SubscriptionFilter
foraws-lambda
Function
an error occurs. This is not the case using only a single instance. Same error occurs when using the.addSubscriptionFilter()
method on theaws-log
LogGroup
directly.Reproduction Steps
Error Log
Environment
Other
According to this code the permission might be attempted to be created multiple times.
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: