Imixal
Imixal

Reputation: 47

Azure Notification Hub. The remote server returned an error: (404) Not Found. NotificationId cannot be found

I'm working with Azure .Net SDK. When I do SendDirectNotificationAsync, I receive NotificationOutcome. Then I get NotificationId from outcome and at once I do GetNotificationOutcomeDetailsAsync. I get response with 404 error. But If I try to repeat one more time, I get NotificationDetail.

Code:

var outcome = hub.SendDirectNotificationAsync(notification, messageCreated.Entity.PushToken).Result;

Unfortunately, I haven't option to use await.

Exception:

Microsoft.Azure.NotificationHubs.Messaging.MessagingEntityNotFoundException: The remote server returned an error: (404) Not Found. NotificationId 'dcd8c78360d24dfa9e99dadfc6b68593-20180403085427-2001954715-1' cannot be found.TrackingId:1f5a51d0-547a-428d-a845-7a164baebf74_G13,TimeStamp:4/3/2018 8:54:27 AM
  Module "Microsoft.Azure.NotificationHubs.Common.ExceptionDispatcher", line 7, col 0, in Throw
    Void Throw(System.Exception)
  Module "Microsoft.Azure.NotificationHubs.Common.AsyncResult", line 310, col 0, in End
    TAsyncResult End[TAsyncResult](System.IAsyncResult)
  Module "Microsoft.Azure.NotificationHubs.NotificationHubManager+<>c", line 0, col 0, in GetNotificationAsync { <lambda> }
    Microsoft.Azure.NotificationHubs.NotificationDetails <GetNotificationAsync>b__24_1(System.IAsyncResult)
  Module "System.Threading.Tasks.TaskFactory 1", line 15, col 0, in FromAsyncCoreLogic
    Void FromAsyncCoreLogic(System.IAsyncResult, System.Func 2[System.IAsyncResult,TResult], System.Action 1[System.IAsyncResult], System.Threading.Tasks.Task 1[TResult], Boolean)
System.Net.WebException: The remote server returned an error: (404) Not Found.
  Module "System.Net.HttpWebRequest", line 273, col 0, in EndGetResponse
    System.Net.WebResponse EndGetResponse(System.IAsyncResult)
  Module "Microsoft.Azure.NotificationHubs.NotificationRequestAsyncResult 1+<>c", line 0, col 0, in GetAsyncSteps { <lambda> }
    Void <GetAsyncSteps>b__26_3(TAsyncResult, System.IAsyncResult)
  Module "Microsoft.Azure.NotificationHubs.Messaging.IteratorAsyncResult`1", line 44, col 0, in StepCallback
    Boolean StepCallback(System.IAsyncResult)

Can somebody provide any help?

Upvotes: 1

Views: 1428

Answers (1)

Bruce Chen
Bruce Chen

Reputation: 18465

AFAIK, the GetNotificationOutcomeDetailsAsync would leverage the REST API Per Message Telemetry: Get Notification Message Telemetry. For the 404 response code, the official documentation has stated as follows:

Telemetry does not exist. This may be because the notification ID is invalid or because the message has not progressed far enough in processing. If you receive a 404 code, wait and try again after 10s. This state can continue for up to 30 minutes.

Note: The above API is only available for Standard tier notification hubs. Moreover, you could follow Diagnose dropped notifications in Notification Hubs to narrow down this issue.

Upvotes: 1

Related Questions