3
votes

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 Phonegap PushPlugin.

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?

1
Have you had any luck tracking this down? I am getting more like a 10% success rate on our dev Notification Hub, and better on the production one. It seems like an issue in Notification Hubs.Eric Hedstrom
&erichedstrom No progress at all. Microsoft asked me to post at MSDN ( social.msdn.microsoft.com/Forums/en-US/… ), but so far no luck. I think the answer will have to come from Microsoft—I don't see what I can change in my setup.David Kolar
I've just opened a support ticket. I will follow up with anything I find out.Eric Hedstrom
Try creating a notification hub namespace and hub in a different region. I was having problems with my Sandbox/dev hub in Western US, but North Central US is working for me.Eric Hedstrom
@YaronLevi Sad to say that I gave up on this when the Azure trial period expired, so I don't have any new info to share, other that changing to the North Central region was a successful workaround for some people.David Kolar

1 Answers

0
votes

Perhaps you are using your phone on a wifi network since you are in development. If this is the case, you may want to check that your router is not blocking the unusual ports apple uses for the apns sandbox. If this is your case you may want to try forwarding the ports: 2195 5223. You may also try turning off wifi all together and trying your cellular network instead.