I'm attempting to create a (beta) Custom Channel for my AWS Pinpoint Project by setting up a CampaignHook that executes a Lambda Function as per the example documentation.
My lambda function seems to work correctly on its own. However, when I get to the point where I am pointing the CampaignHook to the lambda function I am getting this error:
> 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.
My function is in C#, and the handler's signature is:
public async Task<String> FunctionHandler(Object evt, ILambdaContext context)
Any idea what the error message means? I'm not sure if it's a permissions issue or if there's a problem with the command itself.