Push Notifications to iOS not received from Amazon SNS

Took us 3 days to figure the problem. I jot down here for someone's benefit

Short answer: The problem was with Apple Certificate and Private Key. A new certificate generated, and Voila!!

For people who savor the Journey, more than the Result, Read on...

Our app (both iOS & Android) receives notifications for User actions. We have used Amazon SNS to deliver notifications.

Recently, one fine day, Notifications stopped. Naturally, knowing there is nothing wrong with Apple Notifications, we debugged our PHP code. Didn't find anything wrong. A day is spent.

Next day, we decided to eliminate application layer (PHP) from this testing, and test on Amazon SNS console. Amazon Console says, Delivered, but no Notification on the device. We tweak our application JSON payload, to no avail. We went ahead, tried example payload from http://docs.aws.amazon.com/sns/latest/dg/SNSMobilePushAPNSAPI.html in Step 7. That didn't work either. Tried delivering  RAW data, but no Notifiction on device. Tried few other combinations. End result, No notification. Best Issue with Amazon SNS? Don't know. Fairly frustrated by the end of day.

Next day, asked my colleague to create a new Platform Application with the same P12 file. Alas!, the error popped "Invalid Certificate...". While iOS team is sticking to its guns about same certificate & private key working for their setups, including with an example script sending Notifications to their devices. With much discussion, agreed to generate a new Certificate & Private key.

We use the new Private key & Certificate, Voila!! No error from SNS, Notification START!!

Something went wrong with the Private key. Not sure, but do know that Amazon SNS couldn't catch it. A Logically Incorrect Action, Defying Logic helped us nail the problem.

With my immense 18 years of technical experience, I know, when everything logically doesn't work. Be illogical. As Fanta drink quips, Thodi Pagal-panti bhi zaruri hai!


Popular posts from this blog

504 Gateway Timeout on Amazon AWS ELB (Elastic Load Balancer)

AWS RDS incompatible-parameters solved