小编Ash*_*ish的帖子

MissingRequiredParameter:参数中缺少必需的键“消息”

我正在尝试在 AWS Lambda 中调用代码。此 Lambda 代码已使用我的 IOT 按钮进行配置。在运行此代码时,我没有看到任何错误。此外,我在我的移动设备上并没有真正看到所需的推送通知。

我可以在控制台中看到此消息: MissingRequiredParameter: Missing required key 'Message' in params

这是我的代码:

'use strict'; 

console.log('Loading function'); 

var AWS = require('aws-sdk');  

var sns = new AWS.SNS();

AWS.config.region = 'xxxxx'; 

const TopicArn = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'  

exports.handler = function(event, context) { 

    console.log("\n\nLoading handler\n\n"); 
    console.log('Received event:', event); 


  const sin = 
      {
"default": "Start", 
"APNS_SANDBOX":"{\"aps\":{\"alert\":\"Start\"}}", 
"GCM": "{ \"notification\": { \"text\": \"Start\" } }"
} // for single click
  const doub = {
"default": "Stop", 
"APNS_SANDBOX":"{\"aps\":{\"alert\":\"Stop\"}}", 
"GCM": "{ \"notification\": { \"text\": \"Stop\" …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-lambda aws-iot

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

amazon-web-services ×1

aws-iot ×1

aws-lambda ×1