gpt4 book ai didi

aws-lambda - 无服务器框架/Cloudformation : deploying Kinesis trigger with DLQ

转载 作者:行者123 更新时间:2023-12-03 07:40:07 28 4
gpt4 key购买 nike

我正在尝试使用无服务器在 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 不正确。

关于aws-lambda - 无服务器框架/Cloudformation : deploying Kinesis trigger with DLQ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71057678/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com