3

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?

David Kolar
  • 3,475
  • 25
  • 34
  • 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 Feb 22 '15 at 20:51
  • &erichedstrom No progress at all. Microsoft asked me to post at MSDN ( https://social.msdn.microsoft.com/Forums/en-US/0131cdd6-d326-49e8-a91f-d1b49477c9f6/push-notifications-to-apns-fail-50-of-the-time?forum=notificationhubs ), 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 Feb 22 '15 at 20:56
  • I've just opened a support ticket. I will follow up with anything I find out. – Eric Hedstrom Feb 22 '15 at 21:01
  • same problem here. thanks for putting in the msdn leg work on this. – tezromania Feb 25 '15 at 04:09
  • 1
    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 Mar 03 '15 at 04:21
  • @EricHedstrom Thanks for that suggestion Eric. Unfortunately, just as you posted your comment my free trial expired and I can't test out your idea and see if it makes a difference. At the behest of Microsoft, I had posted this problem on MSDN and sent them a link to it, but the issue wasn't resolved. I ran out of time (because the free trial was ending and I needed to make progress on the app) and I switched to another service. Not sure what to do about the question I've posted here since I can't test answers anymore, but I think I'll leave it as-is in case it validates some else's problem. – David Kolar Mar 03 '15 at 15:51
  • I am experiencing the exact same issues you mentioned with a very similar setup. Are there any advances regarding the issue? – Yaron Levi Aug 19 '15 at 00:39
  • 1
    @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 Aug 19 '15 at 01:45

1 Answers1

0

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.

tezromania
  • 797
  • 1
  • 5
  • 18
  • If the ports were blocked on the phone's end, the Azure interface would not know it, correct? Also, it does work half the time. – David Kolar Feb 25 '15 at 10:54
  • Well the reason I ask is that you mentioned you were sending notifications through vs and the debug tab. Both of which wait for the entire result of the notification to return. So you can get information about the entirety of the process. – tezromania Feb 25 '15 at 17:01
  • Thanks for the additional information on how the process works. This can explain why some people see more success in production than sandbox environments. – David Kolar Mar 03 '15 at 15:54
  • clearing out those ports helped us in some of our environments. But also using the suggestion above to spin up instances in North Central worked very well too. Things were going through much faster in North Central despite us being physically located in the west. – tezromania Mar 03 '15 at 20:06