Lambda函数不会发布到SNS或更新dynamodb

我正在尝试更新dynamodb并使用以下代码从Lambda函数发送SNS通知。 即使function成功执行SNS通知也不会发生。 SNS日志也不显示任何条目。 从控制台的SNS到相同的ARN的作品。 检查更新不起作用的dynamodb。 Dynamodb和SNS发布所需的IAMangular色策略已创build。 任何指针或debugging的方式将有所帮助。

'use strict'; console.log('Loading function'); var AWS = require("aws-sdk"); var sns = new AWS.SNS(); AWS.config.update({ region: "us-east-1" }); var docClient = new AWS.DynamoDB.DocumentClient(); exports.handler = (event, context, callback) => { context.callbackWaitsForEmptyEventLoop = false; console.log('Received event: ', JSON.stringify(event, null, 2)); console.log('Received context: ', JSON.stringify(context, null, 2)); // console.log('Cognito id: ', context.identity.cognitoIdentityId); +console.log("Start .................." + new Date().toString());+ console.log("Notifying....:"); sns.publish({ TargetArn: "arn:aws:sns:us-east-1:796915632304:endpoint/GCM/JaybMe/b65794ea-d30d-38a8-8450-e0ff3b877bfc", Message: "Simple notification message " }, function(err, data) { if(err) { console.error('error publishing to SNS'); context.callbackWaitsForEmptyEventLoop = false; callback(err); //context.fail(err); } else { console.info('Message published to SNS'); context.callbackWaitsForEmptyEventLoop = false; callback(null, "SUCCESS"); } }); console.log('Finished function'); context.callbackWaitsForEmptyEventLoop = false; callback(null, "SUCCESS"); } 

testing运行时间4.3和6.10,但行为相同

谢谢Sajeev