I am using sns-mobile
to register mobile device with Amazon SNS. I followed this tutorial on SNS Push Notifications using nodejs.
The code for creating the SNS object looks like the following:
var myApp = new SNS({
platform: SNS.SUPPORTED_PLATFORMS.ANDROID,
region: 'eu-west-1',
apiVersion: '2010-03-31',
accessKeyId: config.sns.key_id,
secretAccessKey: config.sns.secret_key_id,
platformApplicationArn: config.sns.arn
});
The code for registering/adding the user or device in this case is the following:
// Add the user to SNS
myApp.addUser(deviceId, null, function(err, endpointArn) {
// SNS returned an error
if(err) {
console.log(err);
return res.status(500).json({
status: 'error occurred registering device'
});
}
// Tell the user everything is ok
res.status(200).json({
status: 'ok'
});
});
The error logged to the console is the following:
{ [Error: CERT_UNTRUSTED]
message: 'CERT_UNTRUSTED',
code: 'NetworkingError',
region: 'eu-west-1',
hostname: 'sns.eu-west-1.amazonaws.com',
retryable: true,
time: Sun Mar 08 2015 17:13:44 GMT-0700 (US Mountain Standard Time),
statusCode: undefined }
I tried looking around for reasons why this may be happening, but keep coming across claims that it is a problem with nodejs.
Any ideas how to get around this?
The issue was with node v0.10.34 (Node.js). This should be fixed in v0.10.35.
changelog: 2014.12.22, Version 0.10.35 (Stable)
tls: re-add 1024-bit SSL certs removed by f9456a2 (Chris Dickinson)
Solution: Upgrade to node 0.10.35.