Call to NotificationHubClient.SendTemplatenotificationAsync() returns ServiceUnavailable response

OpenDental Developer 0 Reputation points
2025-09-10T17:08:48.97+00:00

Our calls to NotificationHubclient.SendTemplatenotificationAsync() had been working up until yesterday. With no changes to the service making calls to NotificationHubClient.SendTemplatenotificationAsync(), We started receiving the below errors.

Our registrations are no where near the device limit, nor is our number of requests near our threshold. As of now there are no outages reported for our region, West US.

Unknown error has occurred.. TrackingId:5aea6da7-0259-45e4-af24-8466a7e4f482,TimeStamp:9/9/2025 4:50:50 PM +00:00 Microsoft.Azure.NotificationHubs.Messaging.MessagingException The remote server returned an error: (503) ServiceUnavailable. Reason: Service Unavailable..TrackingId:e4d569f9-1458-47fd-9ede-d6648964f5aa,TimeStamp:2025-09-09T15:51:10.3491014Z Microsoft.Azure.NotificationHubs.Messaging.ServerBusyException

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
{count} votes

1 answer

Sort by: Most helpful
  1. RAMAMURTHY MAKARAPU 1,130 Reputation points Microsoft External Staff Moderator
    2025-09-11T00:26:52.52+00:00

    Hello @OpenDental Developer ,

    Thank you for submitting your question on Microsoft Q&A.

    This typically points to a transient backend issue on Azure Notification Hubs rather than a misconfiguration on your side. Even though your region (West US) shows no outage in the Service Health dashboard, Notification Hubs sometimes throttle or return 503 Service Unavailable when:

    • Backend load spikes (temporary service-side issue).
    • High request concurrency from your app (even if you’re under limits, sudden bursts can trigger throttling).
    • Template notification bugs (FCMv1 in particular has had instability with template sends).

     Recommended steps to resolve the issue

    Implement Retry Logic

    • Wrap SendTemplateNotificationAsync() with exponential backoff retries.
    • Microsoft recommends retrying on ServerBusyException or MessagingException. Example backoff: 2s → 4s → 8s → up to ~1 minute.

    Check Azure Service Health (per-resource)

    • In the Azure Portal → Notification Hub → Service Health → Resource Health
    • This often shows localized transient issues even if the region-wide dashboard is green.

    Validate Registration Payloads

    • Ensure no malformed tags or template parameters.
    • Known bug: very complex tag expressions or exceeding the limit (20 OR-only, 6 mixed) can cause 5xx errors.

    Scale Out Usage

    • If traffic is spiky, consider distributing sends (batching messages, using multiple hubs if needed).

    In most cases, these 503 errors are short-lived service-side throttles and resolve after retry.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.