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 notification not delivered via parse #23

Closed pewh closed 5 months ago

pewh commented 8 years ago

Hi. I was able make to make push notification is working. I tested it on REST.

POST
Host: android.googleapis.com/gcm/send
Content-Type: application/json
Authorization: key=**apiKey**
Cache-Control: no-cache
Postman-Token: b33c61dc-a779-9198-bd96-aaf6c24fac6c

{
  "data": {
      "message": "hello world"
  },
  "registration_ids" : ["**deviceToken**"]
}

and my device got notification. Now I'm struggling to make parse push working.

POST localhost:7002/server/push
X-Parse-Application-Id: SSShop
X-Parse-Master-Key: 123
Content-Type: application/json

{
  "where": {},
  "data": {
      "alert": "hello world 123"
  }
}

the output: { result: true }, but notification is not received on device. Trying send push notification via Parse Dashboard and got output like this:

verbose: sending push to 2 installations
verbose: sent push! 0 success, 0 failures.

server.js:

...
const instance = {
  appId:            'SSShop',
  port:             7002,
  serverURL:        'http://localhost:7002/server',
  masterKey:        '123',
  databaseURI:      'mongodb://docker/ssshop',
  publicServerURL:  'http://localhost:7002/server',
  mountPath:        '/server',
  verifyUserEmails: true,
  appName:          'SSShop',
  emailAdapter: {
    module: 'parse-server-simple-mailgun-adapter',
    options: {
      fromAddress: 'XX',
      domain:      'XX',
      apiKey:      'XX'
    }
  },
  push: {
    android: {
      senderId: "92014XXXXX",
      apiKey: "**apiKey**"
    }
  }
}
...

package.json:

    "parse": "~1.8.5",
    "parse-dashboard": "~1.0.13",
    "parse-server": "~2.2.11",

checking node_modules and got parse-server-push-adapter use version 1.0.4.

flovilmart commented 8 years ago

Can you please provide the server logs? the GCM adapter will likely provide a more verbose output when running with VERBOSE=1

pewh commented 8 years ago

Hi @flovilmart, I use Express with Parse Server, with babel-node. I run the script with babel-node ./server/server.js. So, where should I add VERBOSE=1? Did you mean like VERBOSE=1 babel-node ./server/server.js?

flovilmart commented 8 years ago

Yup!

Le 27 juin 2016 04:55 -0400, Pewh Goshnotifications@github.com, a écrit :

Hi@flovilmart(https://github.com/flovilmart), I use Express with Parse Server, with babel-node. I run the script withbabel-node ./server/server.js. So, where should I add VERBOSE=1? Did you mean likeVERBOSE=1 babel-node ./server/server.js?

— You are receiving this because you were mentioned. Reply to this email directly,view it on GitHub(https://github.com/parse-server-modules/parse-server-push-adapter/issues/23#issuecomment-228689223), ormute the thread(https://github.com/notifications/unsubscribe/AAWQGC1NFX16AyvCkkGuks9cgVJIZNbMks5qP5ATgaJpZM4IypJc).

pewh commented 8 years ago

By the way, I already added verbose in express conf

...
const server = express();

server.use(
  '/ssshop',
  new ParseServer({
    databaseURI: instance.databaseURI,
    cloud: path.resolve(__dirname, 'cloud.js'),
    appId: instance.appId,
    masterKey: instance.masterKey,
    serverURL: instance.serverURL,
    verbose: true,
  })
);
...

Should I added VERBOSE=1?

pewh commented 8 years ago

I just got something like this:

verbose: sending push to 2 installations
verbose: sent push! 0 success, 0 failures.
mtrezza commented 5 months ago

Closing as outdated