Sending a push notification from an Azure Mobile Services Notification Hub to an iOS device fails half the time with this error:
The Push Notification System returned an Internal Server Error
Here is my setup:
- Free Trial version of Azure
- Sandbox certificates uploaded to a Mobile
- Service/Notification Hub App developed with PhoneGap and built using Adobe's PhoneGap Build service
- Using the
com.microsoft.azure-mobile-services
Cordova plugin (along with the standard PhonegapPushPlugin
.
I am able to use either the DEBUG page on the Azure site, Visual Studio 2013 (Server Explorer -> Azure), or the ServiceBusExplorer open source program to send test JSON messages to Apple. It works, half the time, and the other half of the time I receive the error above.
Steps to reproduce:
- Open Visual Studio --> Server Explorer --> Azure. It points to my trial account.
- Context-click on my Notification Hub a pick "Diagnose"
- Under Device Registrations, I delete any registrations I've previously accumulated. There are now no device registrations.
- Delete and re-install the test app on the iPhone (iOS 8)
- Launch the test app. A new registration appears in the notification hub. The type is "Native." (I've also had problems with "Template.")
- Go to the Test Send tab; Recipient: Broadcast; Message Type: Apple (Default)
- I am using the default, sample notification (but I get similar outcomes with other JSON messages):
{"aps":{"alert":"Notification Hub test notification"}}
- Hit "Send"; It fails. Under "Message Result:," for my single registration I have this error message: "The Push Notification System returned an Internal Server Error"
- Wait 90 seconds, hit Send again. The notification works, it appears on the phone, the message result is "The Notification was successfully sent to the Push Notification System"
- Wait another 90 seconds, hit Send again. The notification fails with the same Internal Server Error that it did the first time.
- Wait another 90 seconds, hit Send again. It works perfectly just like it did on the second attempt.
Overall it is working about half the time. In the example above, it worked every-other time, but this is not always the case--it can succeed multiple times in a row or fail multiple times in a row. I'm not changing the JSON at all between the above test messages. Even if I vary the JSON, I get the same outcome. I get similar outcomes regardless of whether I do the testing through Visual Studio (above), the Azure portal (the DEBUG tab), or through the ServiceBusExplorer program.
What is causing this? How do I troubleshoot this?