Please provide the following:
- expo-server-sdk: “^3.4.0”
- Platforms(Android/iOS/web/all): iOS
I’m currently using expo-server-sdk to send a multiple push notifications, but getting the following error:
{ Error: “value” must be an object, “value” at position 0 fails because [child “to” fails because [“to” must be a string, “to” must be an array]].
Valid push tokens are passed to expo.chunkPushNotifications
, but when chunk
is passed to expo.sendPushNotificationsAsync(chunk)
, I get the error message mentioned above:
(async () => {
for (let chunk of chunks) {
try {
let ticketChunk = await expo.sendPushNotificationsAsync(chunk);
tickets.push(...ticketChunk);
} catch (error) {
console.error(error);
}
}
})();
The chunk
is in the following form:
[ { to:
{ notificationToken: 'ExponentPushToken[some_push_token]' },
sound: 'default',
body: 'This is a test notification',
data: { withSome: 'data' } },
]
which means the chunks
is in the from of an array of an array of objects:
[ [ { to: [Object],
sound: 'default',
body: 'This is a test notification',
data: [Object] },
]]