serverless-plugin-log-subscription icon indicating copy to clipboard operation
serverless-plugin-log-subscription copied to clipboard

apiGatewayLogs only accepts lambda functions as a `destinationArn`

Open nayoa opened this issue 3 years ago • 0 comments

We want to send API Gateway logs to a Kinesis Firehose destination. The current behaviour of the plugin is to accept only lambda functions as a destination.

Current behaviour:

  logSubscription:
    enabled: true
    destinationArn: arn:aws:firehose:eu-west-1:xxxxxxx:deliverystream/xxxxxx
    roleArn: arn:aws:iam::xxxxxxxx:role/xxxxxxx
    apiGatewayLogs: true

Output:

Error:
CREATE_FAILED: ApiGatewayExecutionLogGroupLambdaPermission (AWS::Lambda::Permission)
1 validation error detected: Value 'arn:aws:firehose:eu-west-1xxxxxxx:deliverystream/xxxxxxx' at 'functionName' failed to satisfy constraint: Member must satisfy regular expression pattern: (arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))? (Service: AWSLambdaInternal; Status Code: 400; Error Code: ValidationException; Request ID: 69e7a603-dee1-465d-afcc-39b4094a7b79; Proxy: null)

Expected behaviour:

Plugin has the ability to detect the type of destinationArn. If the destinationArn is not a Lambda function, it does not create an AWS::Lambda::Permission or depend on it.

nayoa avatar May 03 '22 14:05 nayoa