【发布时间】:2016-01-31 20:31:05
【问题描述】:
我为沙盒 iOS 设置了推送通知,它们曾经可以工作,但由于某种原因,目前无法正常工作。这是来自云观察日志的错误 AWS SNS:
{
"notification": {
"messageMD5Sum": "39af77c36a92b71afb73212e74adf845",
"messageId": "f8b4a21e-c3ba-52ed-8b17-ed36acf37e65",
"timestamp": "2016-01-31 20:22:33.154"
},
"delivery": {
"deliveryId": "a0941dde-8990-54ee-96e3-52f6e6d993d0",
"destination": "arn:aws:sns:us-east-1:445291524102:endpoint/APNS_SANDBOX/BusyTime/a97020ec-4121-3995-a119-a7b6779ed602",
"providerResponse": "NotificationErrorResponse(command=8, status=InvalidToken, id=1, cause=null)",
"dwellTimeMs": 525,
"attempts": 1,
"token": "df6cb7064c391cc8ca1709c127b40f838768336c691512e00c73d01a18d6b0af",
"statusCode": 8
},
"status": "FAILURE"
}
这是我的发送代码(AWS Lambda 调用此代码):
params = {"Attributes": { //update the endpoint
"Enabled": 'true',
},
"EndpointArn" : user.endpointARN.S
}
sns.setEndpointAttributes(params, function(err, data) {
if (err){
console.log(err, err.stack);
}
else{
var paramsSNS = {
TargetArn:user.endpointARN.S,
Message:message
};
sns.publish(paramsSNS, function(err, data) {
if (err){
console.log(err, err.stack);
}
else{
console.log(data);
context.succeed(data);
}
});
}
});
Lambda 方法的返回数据:
{
"ResponseMetadata": {
"RequestId": "61f9bc48-fd8b-5408-b7a9-f36093c023ad"
},
"MessageId": "657eaace-69aa-5f87-96dd-e5e607e1d822"
}
我已将问题缩小到不与我的 lambda 方法关联,因为我尝试发布到直接从 SNS 控制台创建的端点。我也想知道为什么这个旧的实现在过去,一两个月前有效,而不再有效。我相信这可能与过时的证书有关,但我不确定如何检查/如果我的证书过时,我认为我不会收到这种提供者的回复。
【问题讨论】:
标签: amazon-web-services apple-push-notifications amazon-sns aws-lambda