Closed ghost closed 8 years ago
@intervity Can you please provide the code you used to send the message?
Thanks!
@eladnava
My send code is below.
app.post('/', function(req, res) {
var regTokens = req.body.device_token;
var message = {};
message.title = req.body.title;
message.sender_type = req.body.sender_type;
message.sender_name = req.body.sender_name;
message.sender_profile_image = req.body.sender_profile_image;
message.content = req.body.message;
sendData.addData('message', message);
sender.send(sendData, { registrationTokens: regTokens }, 3, function (err, response) {
if(err) console.log(err);
else console.log(response);
});
res.send('ok');
});
and i think i know reason. the registraionTokens is array. but i sent a string. so i have a error code. i did test. I change registraionTokens from string to array. then It's OK.
@intervity Correct, that would be the reason you're getting this error.
We have an open issue about this and will fix it in the next few days.
@eladnava thank you! It's a very nice module !!
Hello. I sent a message and I got a message succesfully. but I have a error code.
The code is below.
TypeError: Cannot read property 'error' of undefined at /var/www/app/push_nodejs/node_modules/node-gcm/lib/sender.js:207:40 at parseAndRespond (/var/www/app/push_nodejs/node_modules/node-gcm/lib/sender.js:26:5) at Request._callback (/var/www/app/push_nodejs/node_modules/node-gcm/lib/sender.js:125:9) at Request.self.callback (/var/www/app/push_nodejs/node_modules/node-gcm/node_modules/request/request.js:198:22) at Request.emit (events.js:98:17) at Request. (/var/www/app/push_nodejs/node_modules/node-gcm/node_modules/request/request.js:1035:10)
at Request.emit (events.js:117:20)
at IncomingMessage. (/var/www/app/push_nodejs/node_modules/node-gcm/node_modules/request/request.js:962:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16