xtrinch / fcm-django

FCM Django: Send push notifications via django to websites, iOS & android mobile devices through FCM (Firebase Cloud Messaging)
http://fcm-django.readthedocs.io/
MIT License
775 stars 196 forks source link

InternalPackageError #10

Closed BojanKogoj closed 7 years ago

BojanKogoj commented 7 years ago

When trying to send notification to multiple devices (and only one is in queryset) I get InternalPackageError(u'to\n',) if that device is active=False

The same error through administration

InternalPackageError at /admin/fcm_django/fcmdevice/

to

Request Method: POST Request URL: http://localhost:8000/admin/fcm_django/fcmdevice/ Django Version: 1.10.1 Exception Type: InternalPackageError Exception Value:

to

Exception Location: .../lib/python2.7/site-packages/pyfcm/baseapi.py in send_request, line 205

I know you shouldn't try and send a notification to an inactive device, but I think this should be handled.

Might be related to (fix issue?) https://github.com/olucurious/PyFCM/issues/60

xtrinch commented 7 years ago

Please post pyfcm and django-fcm versions from pip freeze

BojanKogoj commented 7 years ago

fcm-django==0.2.4 pyfcm==1.0.7

xtrinch commented 7 years ago

Does manualy installing newest version of pyfcm fix the issue?

BojanKogoj commented 7 years ago

pyfcm==1.2.3

Still throws an error

BojanKogoj commented 7 years ago

But the new version has other issues now (even if active=True)

TypeError at /admin/fcm_django/fcmdevice/

list indices must be integers, not unicode

Request Method: POST Request URL: http://localhost:8000/admin/fcm_django/fcmdevice/ Django Version: 1.10.1 Exception Type: TypeError Exception Value:

list indices must be integers, not unicode

Exception Location: .../lib/python2.7/site-packages/fcm_django/models.py in send_message, line 55

xtrinch commented 7 years ago

Okay it seems I will have to dig deeper into this.

olucurious commented 7 years ago

@xtrinch please check the update response return type for single device and multiple devices to make sure it's not breaking your library.

You're doing a great job here, I'll link back to your fcm-django from pyfcm.

xtrinch commented 7 years ago

@olucurious I've just updated it to work with the latest version of pyfcm, and this particular issue was firebase returning 400 error, because I've been passing empty registration ID array to your library (not an error in yours). I've now fixed it so it should not come to this problem anymore.

See 0.2.5 release (@BojanKogoj).

And thanks!

BojanKogoj commented 7 years ago

Thanks! Will test it next week and report back if I find any bugs. Owe you a beer for such fast response