Skip to content

TypeError: value is not iterable while accessing registrations in @azure/notification-hubs NotificationHubsClient #34257

@EmilioP94

Description

@EmilioP94
  • Package Name: @azure/notification-hubs
  • Package Version: 2.0.0
  • Operating system: MacOS 15.3.1
  • nodejs
    • version: 22.3
  • browser
    • name/version:
  • typescript
    • version: 5.8.3
  • Is the bug related to documentation in

Describe the bug
When trying to iterate over pages returned by registrations.byPage() from the NotificationHubsClient class, node is throwing the following error:

ERROR [ExceptionsHandler] value is not iterable - {
  stack: [
    'TypeError: value is not iterable\n' +
      '    at getHeadersOrUndefined (/Users/emile/Documents/Repos/ocean-cloud-ts/node_modules/@azure/notification-hubs/src/serializers/registrationSerializer.ts:509:35)\n' +
      '    at Object.createAppleTemplateRegistrationDescription (/Users/emile/Documents/Repos/ocean-cloud-ts/node_modules/@azure/notification-hubs/src/serializers/registrationSerializer.ts:284:20)\n' +
      '    at Object.parseRegistrationFeed (/Users/emile/Documents/Repos/ocean-cloud-ts/node_modules/@azure/notification-hubs/src/serializers/registrationSerializer.ts:224:27)\n' +
      '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
      '    at _listRegistrationsByTag (/Users/emile/Documents/Repos/ocean-cloud-ts/node_modules/@azure/notification-hubs/src/api/listRegistrationsByTag.ts:97:25)'
  ],
  error: {}
}

To Reproduce
Steps to reproduce the behavior:
Use the proposed code in this documentation: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/notificationhubs/notification-hubs/README.md#registrations-api:

import { NotificationHubsClient } from "@azure/notification-hubs";

const client = new NotificationHubsClient("<connection string>", "<hub name>");

const registrations = client.listRegistrationsByTag("likes_hockey");

let page = 0;
for await (const pages of registrations.byPage()) {
  console.log(`Page number ${page++}`);
  for (const item of pages) {
    console.log(JSON.stringify(item, null, 2));
  }
}

Expected behavior
It should properly iterate on registration pages and not crash with a TypeError

Screenshots
N/A

Additional context
N/A

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Notification Hubcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions