Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[notification-hubs] Fcmv1 misleading type for createFcmV1Notification #29371

Closed
1 of 6 tasks
lastapella opened this issue Apr 19, 2024 · 2 comments
Closed
1 of 6 tasks
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team Notification Hub question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.

Comments

@lastapella
Copy link

lastapella commented Apr 19, 2024

  • Package Name: @azure/notification-hubs
  • Package Version: 1.2.0
  • Operating system: macos
  • nodejs
    • version: 18.x
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
Two issues with fcmv1 support:
The type for createFcmV1Notification are misleading as it expect an object like the following:

const notificationPayload1 = {
		body: { notification:{ body: 'notification content', title: 'notification title' }, data: info }, 
	}
createFcmV1Notification(notificationPayload1) // incorrect

but in fact the it should be

const notificationPayload2 = {
		body:  { message: { notification: { body: 'notification content', title: 'notification title' }, data: info }}, 
	}
createFcmV1Notification(notificationPayload2) // correct

Both the types and the sample-dev are incorrect. This is documented in the firebase migration guide: https://firebase.google.com/docs/cloud-messaging/migrate-v1#before-notification

To Reproduce
Steps to reproduce the behavior:

  1. Configure the azure notification hub with fcmv1 credentials
  2. Send the notification
  3. Verify the notification is received on the device (testing with an Android device)

Expected behavior
Mobile device should receive the notification

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team Notification Hub question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. labels Apr 19, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @tjsomasundaram.

@lastapella lastapella changed the title [notificationhubs] Fcmv1 misleading type and missing listRegistrationByChannel [notificationhubs] Fcmv1 misleading type for createFcmV1Notification Apr 19, 2024
@lastapella lastapella changed the title [notificationhubs] Fcmv1 misleading type for createFcmV1Notification [notification-hubs] Fcmv1 misleading type for createFcmV1Notification Apr 19, 2024
mpodwysocki added a commit that referenced this issue Apr 24, 2024
… registrations (#29422)

### Packages impacted by this PR

- @azure/notification-hubs

### Issues associated with this PR

- #29404
- #29371
- #29372

### Describe the problem that is addressed by this PR

- Fixes the issue with creating a wrapper around the entire FCM V1
notification body to include `message`.
- Changes the data types of the `data` properties from `Record<string,
any>` to `Record<string, string>`.
- Fixes the `listRegistrationsByChannel` to include `fcmv1` as a
parameter to query for devices.

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_

Added unit tests for the helper for `listRegistrationsByChannel` to
validate the query string returned.

### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [x] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [x] Added a changelog (if necessary)
@mpodwysocki
Copy link
Contributor

Closed by #29422

@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team Notification Hub question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants