Serverless.com / CloudFormation:未在 AWS Lambda EventSourceMapping 上设置属性 "Retry attempts"、"Maximum age of record" 到 DynamoDB 流

Serverless.com / CloudFormation: Properties "Retry attempts", "Maximum age of record" not set on an AWS Lambda EventSourceMapping to a DynamoDB Stream

我正在尝试将 AWS Lambda EventSourceMapping 上的属性 "Retry attempts" 和 "Maximum age of record" 设置为 DynamoDB 流 - 通过 serverless.ymlserverless framework。 部署堆栈时,它们会保留默认值,而不是我设置的值。帮助?谢谢

我的代码:

name-of-serverless-function
handler: src/functions/my.handler
  events:
    - stream:
        type: dynamodb
        batchSize: 1
        maximumRetryAttempts: 2
        maximumRecordAgeInSeconds: 8
        arn: properWorkingARN

你的 serverless 版本是多少?

我怀疑您使用的 serverless 版本不支持您正在使用的 stream 事件语法。

例如,maximumRetryAttempts 从版本 1.60.0 开始支持。

serverless 通常只是忽略不支持的语法,不返回任何错误。

尝试检查您的 serverless 版本是否支持您在 here 中想要的内容,或者升级到最新版本再试一次。

此外,您可以检查 cloudformation 文件 serverless 创建以在 .serverless/cloudformation-template-update-stack.json 中部署您的项目。检查 cloudformation 是否按照您对文件的预期创建。

---编辑---

我发现 serverless 现在似乎不支持 MaximumRecordAgeInSeconds。这是打开issue.

我刚刚发送了一个实现 属性 MaximumRecordAgeInSeconds 的 PR 对于 Kinesis 和 DynamoDB 流:https://github.com/serverless/serverless/pull/7833