You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to send a notification using the OneSignal SDK, a JSON decoding error is encountered, resulting in the following message: JSONDecodeError: Expecting value: line 1 column 1 (char 0).
This issue occurs consistently when attempting to send a notification using the provided client.send_notification function.
This error has been occurred about 6 times only for the last 30 days.
Snippet of code:
@shared_task(bind=True)
def notify_user(self, id):
if settings.TEST:
logger.info("push notification on CircleCi")
return
try:
instance = NotificationModel.objects.get(pk=id)
except NotificationModel.DoesNotExist:
logger.info('Notification is not found')
return
notification = dict()
if settings.ONESIGNAL_SANDBOX:
to = [settings.ONESIGNAL_TEST_PLAYER_ID]
elif not instance.user.devices.exists():
logger.info('User {} has not devices attached'.format(instance.user.email))
return
else:
to = list(map(lambda d: d.player_id, instance.user.devices.filter(player_id__isnull=False)))
if len(to) == 0:
return
notification['include_player_ids'] = to
notification['contents'] = {
'en': instance.content
}
notification['headings'] = {
'en': instance.title,
}
notification['ios_badgeType'] = 'Increase'
notification['ios_badgeCount'] = 1
try:
response = client.send_notification(notification)
except Exception as e:
logger.info(f"Error is {e}")
raise self.retry(max_retries=5, countdown=(30), exc=e)
return response.body
Steps to reproduce?
1- Error when sedning some notifications for the users.
What did you expect to happen?
I expected all notifications to be sent successfully.
What happened?
When attempting to send a notification using the OneSignal SDK, a JSON decoding error is encountered, resulting in the following message:
JSONDecodeError: Expecting value: line 1 column 1 (char 0).
This issue occurs consistently when attempting to send a notification using the provided
client.send_notification
function.This error has been occurred about 6 times only for the last 30 days.
Snippet of code:
Steps to reproduce?
What did you expect to happen?
I expected all notifications to be sent successfully.
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: