无服务器 framework/Cloudformation:使用 DLQ 部署 Kinesis 触发器

Serverless framework/Cloudformation: deploying Kinesis trigger with DLQ

我正在尝试使用无服务器在 AWS 上部署一个 lambda,它以 Kinesis 数据流作为触发器。我还想定义将 lambda 引发的任何失败消息发送到死信队列。

我在无服务器文档中找不到如何执行此操作的示例,但我在 https://betterdev.blog/aws-lambda-kinesis-trigger-pitfalls/.

中找到了我认为如何执行此操作的示例

我创建了一个无服务器文件,其中 lambda 目标如下所示:

my_lambda:
    handler: src/lambdas/my_lambda.lambda_handler
    name: my_lambda
    memorySize: 256
    timeout: 28
    package:
        patterns:
          - 'src/lambdas/my_lambda.py'
    role: MyLambdaRole # Defined in a separate file.
    events:
        - stream:
            type: kinesis
            arn: ${self:custom.MY_KINESIS_DATA_STREAM_ARN} # ARN of Kinesis data stream.
            batchSize: 100
            maximumRetryAttempts: 10
            startingPosition: LATEST
            enabled: false
            destinations:
                onFailure:
                    type: sqs
                    arn: ${self:custom.MY_DLQ_ARN} # ARN of SQS DLQ.
    environment:
        ....
    tags:
        ....

当我尝试部署时,出现此错误:

TypeError: Cannot read property 'replace' of undefined
  at Object.normalizeNameToAlphaNumericOnly (/usr/local/lib/node_modules/serverless/lib/plugins/aws/lib/naming.js:32:36)
  at Object.getStreamLogicalId (/usr/local/lib/node_modules/serverless/lib/plugins/aws/lib/naming.js:372:14)
  at functionObj.events.forEach (/usr/local/lib/node_modules/serverless/lib/plugins/aws/package/compile/events/stream.js:184:58)
  at Array.forEach (<anonymous>)
  at serverless.service.getAllFunctions.forEach (/usr/local/lib/node_modules/serverless/lib/plugins/aws/package/compile/events/stream.js:143:28)
  at Array.forEach (<anonymous>)
  at AwsCompileStreamEvents.compileStreamEvents (/usr/local/lib/node_modules/serverless/lib/plugins/aws/package/compile/events/stream.js:93:47)
  at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:579:20)

该消息对确定问题所在没有帮助。请问有人能提出问题所在吗?

提前感谢您的帮助。

已修复:我的 Kinesis 数据流 ARN 不正确。