Skip to content

(aws-lambda-destinations): update docs to warn users that Fifo queues aren't supported as destinations #13793

@lewisdawson

Description

@lewisdawson

During creation of a Lambda defined in a Python stack, a status code 400 InvalidParameterValueException is thrown. It fails to create the SQS on_failure DestinationConfig and the stack creation fails with a rollback.

Reproduction Steps

Deploying the following stack triggers the failure:

from aws_cdk import (
    core,
    aws_lambda as lambda_,
    aws_lambda_destinations as lambda_dest,
    aws_sqs as sqs,
)
from aws_cdk.aws_lambda_python import PythonFunction


class StackHello(core.Stack):

    def __init__(self, scope: core.Construct, construct_id: str,
                 **kwargs) -> None:
        super().__init__(scope, construct_id, **kwargs)

        self._create_hello_lambda()

    def _create_hello_lambda(self) -> None:
        q = sqs.Queue(
            scope=self,
            id='hello-fail.fifo',
            queue_name='hello-fail.fifo',
            encryption=sqs.QueueEncryption.KMS_MANAGED,
            fifo=True,
            content_based_deduplication=True,
            visibility_timeout=core.Duration.seconds(90)
        )
        
        fn = PythonFunction(
            scope=self,
            id='hello_function',
            handler='main',
            entry='hello',
            index='hello.py',
            runtime=lambda_.Runtime.PYTHON_3_7,
            on_failure=lambda_dest.SqsDestination(q)
        )
        q.grant_send_messages(fn)

What did you expect to happen?

Trying to deploy a Lambda function through the CDK that sends any message that failed to process to a dead letter queue.

What actually happened?

The deploy fails with the exception below:

8:32:00 AM | CREATE_FAILED        | AWS::Lambda::EventInvokeConfig | hello_function/EventInvokeConfig
The provided destination config DestinationConfig(onSuccess=OnSuccess(destination=), onFailure=OnFailure(destination=arn:aws:sqs:us-east-1:<redacted>:hello-fail.fifo)) is invalid. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueEx
ception; Request ID: bf0267ad-14f8-4d6d-b788-b547e390f8f0)

Environment

  • CDK CLI Version : 1.94.1 (build 60d8f91)
  • Framework Version: 1.94.1
  • Node.js Version: v15.5.1
  • OS : macOS Catalina (10.15.7)
  • Language (Version): Python 3.7.8

Other

None.


This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-lambdaRelated to AWS Lambda@aws-cdk/aws-sqsRelated to Amazon Simple Queue ServicedocumentationThis is a problem with documentation.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions