As suggested in the official document, we could use Get Notification Message telemetry REST API when we have issue/failure with pushing notifications in the Azure Notification Hub. We can use this API to review and monitor the pushed notifications. There is one prominent property named PnsErrorDetailsUri for our troubleshooting which indicates the details of error reported by PNS. However, the PnsErrorDetailsUri might not be found in the response payload sometimes when we use SDK which blocks our investigation. This article provides some troubleshooting threads to narrow down why we can’t invoke Telemetry API successfully or get PnsErrorDetailsUri property while invoking this API.
Troubleshooting Steps:
1.Please check the pricing tier of your Notification Hub firstly. The telemetry API is only available for Standard tier Notification Hub.
2.If no errors were reported by a PNS, the PnsErrorDetailsUri property will not be included in the response payload. Please kindly refer to multiple common errors and possible reasons of this API.
3.Generally, state of message progress could be following values:
If there is any issue while publishing notifications, PNS error details can be found from PnsErrorDetailsUri property after the associated send operation is complete. Please verify if the status tag is Completed in the response payload. The PnsErrorDetailsUri won’t show up when the message is in other statuses.
<NotificationDetails xmlns=http://schemas.microsoft.com/netservices/2010/10/servicebus/connect xmlns:i=http://www.w3.org/2001/XMLSchema-instance>
<NotificationId>{Your message id}</NotificationId>
<Location>sb://{Your namespace}.servicebus.windows.net/{your hub name}/messages/{your message id}?api-version=2015-04</Location>
<State>Completed</State>
<EnqueueTime>2015-11-02T21:19:43Z</EnqueueTime>
<StartTime>2015-11-02T21:19:43.9926996Z</StartTime>
<EndTime>2015-11-02T21:19:43.9926996Z</EndTime>
<NotificationBody><?xml version="1.0" encoding="utf-16"?><toast><visual><binding template="ToastText01"><text id="1">Hello from a .NET App!</text></binding></visual></toast></NotificationBody>
<TargetPlatforms>windows</TargetPlatforms>
<WnsOutcomeCounts>
<Outcome>
<Name>Success</Name>
<Count>3</Count>
</Outcome>
<Outcome>
<Name>WrongToken</Name>
<Count>1</Count>
</Outcome>
</WnsOutcomeCounts>
<PnsErrorDetailsUri>{Blob uri}</PnsErrorDetailsUri>
</NotificationDetails>
4.If the PnsErrorDetailsUri value could not be found in the response payload after ruling out above possibilities, please kindly refer to following considerations:
A. While calling REST API directly, please make sure you are setting API version as 2016-07 and above because the PnsErrorDetailsUri requires Api-Version 2016-07 at least.
B.While calling REST API via SDK, the underlying request may not follow API pattern. For example, we are using historical version 1.0.3 of Microsoft.Azure.NotificationHubs package, there isn’t particular parameter of API version can be passed easily probably.
You could capture the details of testing request by Fiddler tool or other web debugging proxy server tool so that you could decrypt the https request data and verify the specific API version which is used in SDK method by default. Please kindly enable the HTTPs capture feature by the following options(Tools --- Options)
Once the pushing message is triggered, we could check the used API version in the detailed raw data of specific request. As shown below, 2015-04 is used so that we could not get the PnsErrorDetailsUri property successfully.
After upgrading the latest SDK version to 4.1.0, the underlying invoked API version is upgraded as well.
Once we get the value of PnsErrorDetailsUri, we could use the Azure Storage API to read the blob.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.