Open adam-hanna opened 9 years ago
Am I supposed to run Push.Config somewhere and point it to my json file?
This is very weird. When I delete my json file and instead use Push.Configure({ ... }), I get a very similar error:
"TypeError: Object #
FOUND A WORKAROUND!!!
Removing the json file and putting Push.Configure inside of a Meteor.startup on the server worked!
Thats odd, try setting 'meteor --production'
:( same error
scrolled through the long log and found this:
Push configuration, Error: Unexpected token / SyntaxError: Unexpected token /
at Object.parse (native)
at Package (packages/configuration/plugin/push.configuration.js:135)
at __bottom_mark__ (/Users/macintosh/.meteor/packages/meteor-tool/.1.0.35.wql4jh++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/parse-stack.js:92:14)
I'm an idiot. I had left javascript single line comments in my json (i.e. // ). It works now, except I'm getting this error:
I20150110-02:34:55.262(-5)? Create GCM Sender using "my api key"
I20150110-02:34:55.263(-5)? A:Send message to: my-phones-gcm-key
I20150110-02:34:55.732(-5)? ANDROID: Result of sender: {"multicast_id":4672542067878773000,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"NotRegistered"}]}
Maybe my gcm key has changed and it's not being updated to my server? It's weird that i had to put Push.Configure into a meteor startup function. Maybe my key listeners have to go inside a meteor.startup function as well?
True the config have to be plain json - It would be nicer if it was plain javascript - but it would take more effort to implement etc.
{"error":"NotRegistered"}
- it seems as if the client app isnt installed or have registered token on last install?
It would be nice to have a "minimum" push app - I'm giving a speak about this push package at the next copenhagen meteor meetup (Thursday next week) - so I might write a mini app "PushPal" to have as a general test app for credentials etc?
Btw. when the error is recieved is the token removed from the appCollection - just qa - it should clean up invalidated tokens.
hmmm.... yes, it was removed from "_raix_push_app_tokens".
I had set listeners on both the client and server for new tokens. Dunno why either of those didn't fire.... :(
I'm a little bit confused. I have multiple tokens in "_raix_push_app_tokens" for single "userId"'s? Is the newest one the correct one?
Alright, I guess feel free to close this. I've taken Push.Configure out of meteor startup and am no longer receiving the error. Strange that it's all of a sudden working!
I also found out why I wasn't able to send a push notification, the following had been logged in my _raix_push_app_tokens:
{
_id: "Q4gJP84qArqZh6pX7",
appName: "main",
createdAt: ISODate("2015-01-09T21:32:15.000Z"),
updatedAt: ISODate("2015-01-09T21:32:15.000Z"),
userId: null
}
Notice how there is no token! I was able to retrieve the current token for this device with one of your listeners. Now I just need to figure out why google has invalidated my gcm token and won't give me a new one!
ugh..... this is crashing on my heroku server but working fine on my local machine. So weird. Same issues.
Hi @adam-hanna, is this still an issue on the latest version?
The json file is also not working for me. I get TypeError: Object #<EventEmitter> has no method 'serverSend'
. The Push.configure
workaround fixes this for me. This was my config.push.json:
{
"apn": {
"passphrase": "test123",
"key": "testkey.pem",
"cert": "testcert.pem",
"gateway": "gateway.sandbox.push.apple.com"
},
"production": false
}
Hey, so sorry for the slow reply!
I just recently fired this project back up, updated to your latest raix:push version, migrated off heroku and onto digital ocean and everything is working great!
One of the changes listed above fixed the issues! Thanks so much for your great work!
EDIT - FOUND WORKAROUND! See one of my comments, below.
I had push notifications working on Android in one of your old packages, but not anymore. Here's the error I'm getting. I'll post my setup below. Note the method 'sendMessage' is a server side method that I'm calling from the client to send a push notification (I'm sending notifcations out from the server).
I'm getting the following error with Push.sendGCM and Push.sendAPN. I'm also not able to get Push.send to work.
Here's my effort with Push.sendGCM. Scroll much further down below to see my setup for Push.send
error in the server console
App Structure
client.js
server.js
config.push.json
Here's my effort for Push.send. Everything is the same except the end of the server method "sendMessage". This successfully writes to the collection "_raix_push_notifications" but I never receive a notification.
server/server.js
_raix_push_notifications