jazzband / django-push-notifications

Send push notifications to mobile devices through GCM or APNS in Django.
MIT License
2.28k stars 618 forks source link

APNSServerError: ConnectionFailed when testing from django shell #496

Open haleydr82 opened 5 years ago

haleydr82 commented 5 years ago

Receiving a 'ConnectionFailed' error when trying to send a test message from the django shell:

from push_notifications.models import APNSDevice device = APNSDevice.objects.get(id=2) device

device.send_message("Test") No handlers could be found for logger "apns2.client" Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/site-packages/push_notifications/models.py", line 167, in send_message **kwargs File "/usr/lib/python2.7/site-packages/push_notifications/apns.py", line 120, in apns_send_message raise APNSServerError(status=reason_for_exception_class(apns2_exception.__class__)) APNSServerError: ConnectionFailed

Looking at the packet capture (screenshot attached) I can see that the SSL handshake with the APNS server appears to be successful, but then the connection is reset.

Screen Shot 2019-04-30 at 2 38 15 PM

I've tested the same configuration from a sandbox machine and it works fine. All software versions appear to be the same between working and non-working scenarios. The only difference that I can think about is that the non-working configuration is using apache (but I can't think of any reason why this would matter).

I also tested connectivity directly to the APNS server with the certificate, and everything appears to work properly:

Screen Shot 2019-04-30 at 2 43 54 PM

Thanks in advance!

elcolie commented 5 years ago

I confirm. With the master. -e git+git@github.com:jazzband/django-push-notifications.git@c4a0d710711fa27bfb6533c0bf3468cb67a62679#egg=django_push_notifications I don't have a problem.

nadiacq commented 5 years ago

Any solution?