zeyneloz / onesignal-node

A Node.js Library for OneSignal push notification service
MIT License
207 stars 48 forks source link

One invalid player ID cancels whole operation; error doesn't specify which player IDs are invalid #67

Closed dancherb closed 3 years ago

dancherb commented 3 years ago

Hello - I'm attempting to send a push notification to a large amount of users (30+). I'm getting an error Incorrect player_id format in include_player_ids (not a valid UUID). The error returns a list of all of the player IDs I passed in, as opposed to those which are invalid - so there's no way to handle this error or remove the invalid IDs. All of these player IDs appear valid or were valid at some time.

The error is also not in a useful format - it is difficult to ultimately parse the array from within the strings and format it is given.

HTTPError: {"errors":["Incorrect player_id format in include_player_ids (not a valid UUID): [\"b767d517-40cd-4ff3-98bb-5d4e1f7109c5\", \"d269832b-cac6-4d2d-bdfb-e01279f5079a\", \"b8d8ae84-5495-433a-8ac7-abb030e90ba9\", ... \"c29a973a-cc3b-478b-8e82-ad71c19ef6d3\"]"]}

Sending a push notification to a single player ID included in the list - take c29a973a-cc3b-478b-8e82-ad71c19ef6d3 at the end - works fine, showing that everything has been set up correctly. This valid ID is still included in the error list when trying to send to the larger number of users, though.