Azure / azure-notificationhubs-dotnet

.NET SDK for Azure Notification Hubs
MIT License
70 stars 123 forks source link

[BUG] "The supplied notification payload is invalid." when using Apple sound dictionary rather than sound string. #194

Closed tracy-hunt closed 2 years ago

tracy-hunt commented 3 years ago

Describe the bug In an Apple notification, when using the sound dictionary rather than the sound string (https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification#2990112), the hub (SendDirectNotificationAsync) throws an exception.

Exception or Stack Trace at Microsoft.Azure.NotificationHubs.NotificationHubClient.d201.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.NotificationHubs.NotificationHubClient.<>cDisplayClass189_0.<b0>d.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.d41.MoveNext() at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.<RunOperation>d__41.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.NotificationHubs.NotificationHubClient.d__189.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at AzureHubsDebug.Form2.d__2.MoveNext() in C:_git\app-admintools\DebugPushApp\AzureHubWinFormsDebug\AzureHubsDebug\Form2.cs:line 39

To Reproduce Create an Apple notification and replace the sound string with a sound dictionary as per the Apple documentation linked above.

Code Snippet The following sound string works: { "aps":{ "alert":{ "body":"message body", "title":"message title" }, "sound":"custom_sound.wav" } }

The following sound dictionary does not work: { "aps":{ "alert":{ "body":"message body", "title":"message title" }, "sound":{ "critical": 1, "name":"custom_sound.wav", "volume": 1.0 } } }

Expected behavior Azure hubs should accept sound as either a string or a dictionary as per the Apple documentation linked above.

Screenshots N/A

Setup (please complete the following information):

Additional context N/A

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

mpodwysocki commented 3 years ago

@tracy-hunt This is a known issue with our system as we do not support critical alerts yet, however, it is on the roadmap.

mpodwysocki commented 2 years ago

@tracy-hunt This should now be closed as critical sound is now supported.