Why Notifications Fail in Azure Notification Hub and How to Fix Them

Do Huy Hung 0 Reputation points
2025-10-22T12:34:25.87+00:00

I'm using Azure Notification Hub to send Web Push Notifications. When I use VAPID_PRIVATE_KEY and VAPID_PUBLIC_KEY directly and web-push, notifications work correctly on my website and I receive them on my Windows device. However, when I try to send notifications through Azure Notification Hub, they never arrive.

Below is the payload I'm using with the createOrUpdateInstallation method from the @azure/notification-hubs package.

this.client = new NotificationHubsClient(connectionString, hubName, {enableTestSend: true});

Installation: {
  installationId: 'web_development_cms_entity_m1510251307018297107014171',
  platform: 'browser',
  userId: 'm1510251307018297107014171',
  tags: [
    'development_cms_entity_m1510251307018297107014171',
    'development_cms_entity',
    'development_all'
  ],
  pushChannel: {
    endpoint: 'https://wns2-sg2p.notify.windows.com/w/?token=BQYAAADi9Jraq3kClJiljgQeyDGe%2bvwxDDZ%2byYNlxdOCiuYRR4Ap58FvDOPRLy9uDwoZuXGRR5gSuLYSGcSqRPwuOrAkFx47xDS%2fNIiwoXuM5W0bhPqGgoDqoeBV4g27UqOKRm%2bH%2bjosqoqgx7wBfrvogvyBETUDd%2bO%2fZwNGtuwbJm0JfjunAaGLaZ1Ju3XDUria3%2fVE4OxF2iIg1MEA74youeiNoBjUzQQRgHjxYUaqottJmoSuWqOSCXntuTV8Ub5C7Zyu9aQrdFJPgzheVyw3l44rUAJxi8P%2bv94mo1sKqedfhm08rvqUt5mv54xUlyAo%2bc%2bh556bFvLHfHBROoJz6Ps3',
    p256dh: 'BHY-g-X9L--8XIFcziHcry8tBmHPDd6R7m20r5GKzjDWTCKvDxu5RgmM_1icuG2u2WdWRv5Xrk97L-WAevgKwgQ',
    auth: 'JM_i01UWsinXiATixPK0QQ'
  }
}


I then attempted to send the notification using the sendByTagExpression(tagExpression, payload) function, but it didn’t work as expected. The result was as follows:


 {
    "correlationId": "870ee657-031c-4bc7-a31f-d8a986c917c9",
    "trackingId": "d474baeb-d0ac-4637-a743-2a6164f5fbea",
    "successCount": 0,
    "failureCount": 0,
    "results": [],
    "state": "Enqueued"
  }

Even when I use the Send Test feature in the Azure Portal, I receive the error: "The Notification could not be delivered due to an unknown error." I'm not sure how to resolve this issue, and I would really appreciate any guidance or help from someone who has faced this before.

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

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.