alex-friedl / crossplatform-push-notifications-example

Example for crossplatform push notifications with node.js and React Native
MIT License
16 stars 9 forks source link

Failed to send token TypeError: Network request failed #1

Closed nomoreboredom closed 6 years ago

nomoreboredom commented 6 years ago

Hi Alex,

Thanks a lot for a proper example, appreciated. My problem is ${Config.SERVER_URL}/ from https://github.com/alex-friedl/crossplatform-push-notifications-example/blob/master/app/js/index.js#L33 not completing. I am running docker locally, changed google-services.json with the one provided from firebase.

I can see within firebase that my device is connected. Mongo seems to work fine as well, however the log object looks like this: web_1 | 2018-05-02T15:31:34.745Z push:server Request to send push notifications to all device tokens web_1 | 2018-05-02T15:31:34.754Z push:notifications Results for sending notifications: [ { method: 'none', success: 0, failure: 0, message: [] } ]

I can also see my deviceToken propely within the example app. Any idea what may be causing this? I can connect to mongo but can not seem to insert token.

Thanks a lot again!

nomoreboredom commented 6 years ago

Ok so I needed to change SERVER_URL=http://10.0.2.2:3000 from https://github.com/alex-friedl/crossplatform-push-notifications-example/blob/master/app/.env.android#L2 to my IPv4 address. Now I successfully sent the token to mongo. However now it completes the request but fails.

web_1    |     multicastId: [ 7041830987515496000 ],
web_1    |     success: 0,
web_1    |     failure: 1,
web_1    |     message: [ [Object] ] } ]
alex-friedl commented 6 years ago

Hello @nomoreboredom,

the output for error messages from node-pushnotifications is not perfect and I hope to improve that in the future, see https://github.com/appfeel/node-pushnotifications/issues/38

Could you set a breakpoint and inspect the error object or add a custom log message that prints the message object?

alex-friedl commented 6 years ago

Closed for inactivity