1
votes

I'm making an Ionic/Cordova app, which needs push notifications, and have Microsoft Azure as the backend. Since GCM is deprecated in favor of FCM, I'm using that. I have used Add push notifications to your Apache Cordova app tutorial as the base, and referred from Sending push notifications to Android with Azure Notification Hubs as well.

While adding the FCM server key under GCM API Key to Azure App Service Push settings, I get the following error:

Error updating notification hub.

There are no other helpful comments with this.

Previous solutions to similar errors included enabling GCM from Google Developer Console. But FCM does not require that option, as far as I understand. What could be the problem?

1
Could you make sure you're using the right key by trying to Send a request from the command line for GCM to push a message first? If that works and you still have troubles updating your hub, please comment back. If it doesn't, refer to the FCM documentation on how to get the right key first. They keep changing how it's done and it becomes more and more confusing.Nikita R.
@NikitaG. the issue is solved now, and I have no idea how. The notification hub accepted the FCM key at last, almost 3-4 hours after I had registered in FCM. Could this be an issue because the generated FCM key was made publicly available only after a few hours?Leroy Vargis
Thanks for the update. Hm, this is interesting. I don't think there's a good way to tell what had actually happened. Could be a temporary downtime on either FCM or Azure side. But good to know it's working for you now.Nikita R.

1 Answers

2
votes

I've ID'ed the issue, sharing here.

It seems when CORS is enabled (via an extension in the browser), Azure does not accept/identify the FCM key. This issue is not specific to adding FCM key, when CORS is enabled, there are a lot of such issues retrieving data from Azure. I'm not sure how to get this to the people at Azure, so if anyone can, that'd be good.

PS: CORS - Cross Origin Resource Sharing, which is disabled by default by browsers, a common security feature. I had to enable it full-time for my development purpose.