parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
87 stars 99 forks source link

Push notifications not sent #2

Closed firaskafri closed 8 years ago

firaskafri commented 8 years ago

Nothing special


var express = require('express');
var ParseServer = require('parse-server').ParseServer;

var app = express();

// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/app',
  appId: 'APP_NAME',
  masterKey: 'MASTER_KEY',
  cloud: __dirname + '/cloud/main.js',
  serverURL: 'http://localhost:1337/parse', // Don't forget to change to https if needed
    push: {
      android: {
        senderId: 'SENDER_ID',
        apiKey: 'API_KEY'
      }
    }
});

// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);

// Hello world
app.get('/', function(req, res) {
  res.status(200).send('Express is running here.');
});

var port = process.env.PORT || 1337;
app.listen(port, function() {
  console.log('parse-server-example running on port ' + port + '.');
});

Steps to reproduce

Using Parse Android SDK 1.13.0 and parse-server version 2.2.2

Logs/Trace

Parse Server Verbose trace:


POST /parse/push { 'user-agent': 'node-XMLHttpRequest, Parse/js1.8.1 (NodeJS 5.8.0)',
  accept: '*/*',
  'content-type': 'text/plain',
  host: 'localhost:1337',
  'content-length': '311',
  connection: 'close' } {
  "channels": [
    "SOME_CHANNEL"
  ],
  "data": {
    "title": "dummy title",
    "message": "dummy message",
    "action": "ACTION",
    "senderId": "4zSfKw2T5b"
  }
}
response: {
  "response": {
    "result": true
  }
}
response: {
  "response": {
    "result": "sent"
  }
}

DB Record { "_id" : ObjectId("56f45b891eb3cdae4d74d160"), "objectId" : "WWfLEatYht", "pushTime" : "2016-03-24T21:26:33.921Z", "_created_at" : ISODate("2016-03-24T21:26:33.921Z"), "query" : "{\"channels\":{\"$in\":[\"SOME_CHANNEL\"]}}", "payload" : { "title" : "dummy title", "message" : "dummy message", "action" : "ACTION", "senderId" : "4zSfKw2T5b"}, "source" : "rest", "title" : null, "expiry" : null, "status" : **"succeeded", "numSent" : 0**, "pushHash" : "d1eeaba5cb95ce819c32efe295b2fe96", "_wperm" : [ ], "_rperm" : [ ], **"numFailed" : 0**} Can't find anything in server logs even when VERBOSE is set to 1, where can I find GCM request and response?

Possible duplicate #1127

flovilmart commented 8 years ago

how did you setup parse-server?

firaskafri commented 8 years ago

@flovilmart nothing special


var express = require('express');
var ParseServer = require('parse-server').ParseServer;

var app = express();

// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/app',
  appId: 'APP_NAME',
  masterKey: 'MASTER_KEY',
  cloud: __dirname + '/cloud/main.js',
  serverURL: 'http://localhost:1337/parse', // Don't forget to change to https if needed
    push: {
      android: {
        senderId: 'SENDER_ID',
        apiKey: 'API_KEY'
      }
    }
});

// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);

// Hello world
app.get('/', function(req, res) {
  res.status(200).send('Express is running here.');
});

var port = process.env.PORT || 1337;
app.listen(port, function() {
  console.log('parse-server-example running on port ' + port + '.');
});
firaskafri commented 8 years ago

Okay so obviously those updates weren't in the parse-server 2.2.2 release, what's the timeline for next release?

flovilmart commented 8 years ago

I'm adding more tests to the parse-server-push-adapter to make sure the protocol to report push is OK and working correctly

firaskafri commented 8 years ago

@flovilmart would love to help, just give me pointers

flovilmart commented 8 years ago

clone this repo, add unit tests, with your keys, make sure your device receives the push etc...

firaskafri commented 8 years ago

@flovilmart I can confirm the GCM adapter is working.