我正在尝试通过根据示例文档设置一个执行 Lambda 函数的 CampaignHook 来为我的 AWS Pinpoint 项目创建一个(测试版)自定义通道。
我的 lambda 函数似乎可以正常工作。但是,当我将 CampaignHook 指向 lambda 函数时,我收到此错误:
> aws lambda add-permission --function-name arn:aws:lambda:us-east-1:my-account-id:function:MyFunctionName \
--statement-id s1 \
--action lambda:InvokeFunction \
--principal pinpoint.us-east-1.amazonaws.com \
--source-arn 'arn:aws:mobiletargeting:us-east-1:my-account-id:/apps/my-pinpoint-project-id/campaigns/*'
=>
{
"Statement": "{\"Sid\":\"s1\",\"Effect\":\"Allow\",\"Principal\": {\"Service\":\"pinpoint.us-east-1.amazonaws.com\"},\"Action\":\"lambda:InvokeFunction\",\"Resource\":\"arn:aws:lambda:us-east-1:my-account-id:function:MyFunctionName\",\"Condition\":{\"ArnLike\":{\"AWS:SourceArn\":\"arn:aws:mobiletargeting:us-east-1:my-account-id:/apps/my-pinpoint-project-id/campaigns/*\"}}}"
}
> aws pinpoint update-application-settings \
--application-id my-pinpoint-project-id \
--write-application-settings-request '{\"CampaignHook\": { \"LambdaFunctionName\": \"arn:aws:lambda:us-east-1:my-account-id:function:MyFunctionName\", \"Mode\": \"DELIVERY\" }}'
=> An error occurred (BadRequestException) when calling the UpdateApplicationSettings operation: Could not properly invoke Lambda function specified in hook.
我的函数在 C# 中,处理程序的签名是:
public async Task<String> FunctionHandler(Object evt, ILambdaContext context)
知道错误消息是什么意思吗?我不确定这是权限问题还是命令本身有问题。