9to5/pushr-gcm

Android notification failing all the time -- working with typhoeus/curl

Opened this issue · 3 comments

This is what I have in the log: notice that it said Error and then delivered even though it never was delivered.

2015-06-17_17:43:09.15713 [2015-06-17 10:43:09 -0700] ERROR: [android: ConnectionGcm 1] Authentication exception received.
2015-06-17_17:43:09.15721 [2015-06-17 10:43:09 -0700] INFO: [android: ConnectionGcm 1] Message delivered to {"type":"Pushr::MessageGcm","app":"android","registration_ids":["MYID"],"notification_key":"ALERT_UPDATE_AVAILABLE","collapse_key":"ALERT_UPDATE_AVAILABLE","delay_while_idle":null,"time_to_live":7200,"data":{"alert_id":"ALERT_UPDATE_AVAILABLE","alert_args":["Zedd: ","10:43 am "],"alert_time":1434562988,"delivery_confirmation":false}}

I tried using the same hash.to_json with typhoeus and in curl, it worked successfully.

Well, a http status 401 is returned. We can be pretty sure about that:
https://github.com/9to5/pushr-gcm/blob/master/lib/pushr/daemon/gcm_support/connection_gcm.rb#L54-L55

Maybe there is a space before your api key in your configuration?
https://github.com/9to5/pushr-gcm/blob/master/lib/pushr/daemon/gcm_support/connection_gcm.rb#L86

@tompesman well that was even worse, we had a typo in the configuration.api key in the yaml file........

Do you think it's worse adding check (and raise expection) when the needed configuration option are nil?
Also that'd be great if the logging bug that said
2015-06-17_17:43:09.15721 [2015-06-17 10:43:09 -0700] INFO: [android: ConnectionGcm 1] Message delivered
when the message was not delivered because of the 401 could be fix.

Thank you for your help :)

It should raise something here to prevent the 'Message delivered' notification.
https://github.com/9to5/pushr-gcm/blob/master/lib/pushr/daemon/gcm_support/connection_gcm.rb#L55