Open Archideus opened 7 years ago
+1 The internal implementation for APNS was working as well, but when I've upgraded the package this error raises every time!
+1
Using v1.5.0
I've opened an issue in the source package page and now the problem is fixed!
Facing the same error, what was the solution?
Faced the same error. As @Kianoosh76 reported, it is a problem with use_sandbox. The APNSClient in send_batch_message is not being initialized with the proper arg for use_sandbox.
The solution was to set USE_SANDBOX
at every bundle dict in django settings like so. I only needed it in my dev app, so I used a simple check to set it:
for bundle_id in ('com....dev', 'com...dev-alt',
'com...staging', 'com...beta'):
PUSH_NOTIFICATIONS_SETTINGS['APPLICATIONS'][bundle_id] = {
'PLATFORM': 'APNS',
'CERTIFICATE': get_cert_path(bundle_id),
'TOPIC': bundle_id,
'USE_SANDBOX': bundle_id == 'com...dev',
}
Got the same problem "Stream forcefully closed" here, using production cert and the following settings:
PUSH_NOTIFICATIONS_SETTINGS = { "APNS_TOPIC": Bundle id, "UPDATE_ON_DUPLICATE_REG_ID": True, "APNS_USE_SANDBOX": False }
And I'm passing the production cert file when calling send_message.
Fixed, turns out something is wrong with the generated production cert's subject
I use development
cert and my app also in the development
. I need to set settings.py
DEBUG=True
to solve this problem
Got same issue: cert was generated for sandbox, solution: set APNS_USE_SANDBOX=True
, but it may work on opposite way, if you are using production cert with APNS_USE_SANDBOX=True
APNs max_concurrent_streams too high (4294967297), resorting to default maximum (1000) Traceback (most recent call last): File "", line 1, in
File "/usr/local/lib/python3.5/site-packages/push_notifications/models.py", line 129, in send_message
certfile=certfile, kwargs
File "/usr/local/lib/python3.5/site-packages/push_notifications/apns.py", line 137, in apns_send_bulk_message
certfile=certfile, kwargs
File "/usr/local/lib/python3.5/site-packages/push_notifications/apns.py", line 87, in _apns_send
**notification_kwargs
File "/usr/local/lib/python3.5/site-packages/apns2/client.py", line 122, in send_notification_batch
priority, expiration, collapse_id)
File "/usr/local/lib/python3.5/site-packages/apns2/client.py", line 78, in send_notification_async
stream_id = self._connection.request('POST', url, json_payload, headers)
File "/usr/local/lib/python3.5/site-packages/hyper/http20/connection.py", line 281, in request
self.endheaders(message_body=body, final=True, stream_id=stream_id)
File "/usr/local/lib/python3.5/site-packages/hyper/http20/connection.py", line 546, in endheaders
stream = self._get_stream(stream_id)
File "/usr/local/lib/python3.5/site-packages/hyper/http20/connection.py", line 289, in _get_stream
raise StreamResetError("Stream forcefully closed")
hyper.http20.exceptions.StreamResetError: Stream forcefully closed