How to troubleshoot PnsErrorDetailsUri missing issue in Notification Hub telemetry API
Published Feb 01 2022 09:32 PM 2,202 Views
Microsoft

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:

Jay_Gong_0-1643614789247.png

 

 

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>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;toast&gt;&lt;visual&gt;&lt;binding template="ToastText01"&gt;&lt;text id="1"&gt;Hello from a .NET App!&lt;/text&gt;&lt;/binding&gt;&lt;/visual&gt;&lt;/toast&gt;</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.

Jay_Gong_1-1643614789253.png

 

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. 

Jay_Gong_2-1643614789258.png

 

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)

 

Jay_Gong_3-1643614789260.png

 

Jay_Gong_4-1643614789264.png

 

 

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.

 

Jay_Gong_5-1643614789269.png

 

After upgrading the latest SDK version to 4.1.0, the underlying invoked API version is upgraded as well.

 

Jay_Gong_6-1643614789272.png

 

Jay_Gong_7-1643614789293.png

 

Once we get the value of PnsErrorDetailsUri, we could use the Azure Storage API to read the blob.

Co-Authors
Version history
Last update:
‎Feb 01 2022 10:46 PM
Updated by: