Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to notify multiple tokens results in UnknownAppID Error #80

Open
bdoms opened this issue Mar 10, 2016 · 4 comments
Open

Trying to notify multiple tokens results in UnknownAppID Error #80

bdoms opened this issue Mar 10, 2016 · 4 comments

Comments

@bdoms
Copy link

bdoms commented Mar 10, 2016

On the v50 branch I can send notifications to individual tokens all day long and it works great.

But the instant I try to send to a list of tokens I get this error every single time. Nothing else has changed. Full trace below.

OST /notify HTTP/1.1" 500 9126 "-" "python-requests/2.7.0 CPython/3.4.2 Linux/3.13.0-77-generic"
2016-03-10 03:05:41+0000 [HTTPChannel (TLSMemoryBIOProtocol),4,107.21.155.154] Unhandled Error
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 1478, in dataReceived
        finishCallback(data[contentLength:])
      File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 1736, in _finishRequestBody
        self.allContentReceived()
      File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 1799, in allContentReceived
        req.requestReceived(command, path, version)
      File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 832, in requestReceived
        self.process()
    --- <exception caught here> ---
      File "/usr/local/lib/python2.7/dist-packages/twisted/web/server.py", line 183, in process
        self.render(resrc)
      File "/usr/local/lib/python2.7/dist-packages/twisted/web/server.py", line 234, in render
        body = resrc.render(self)
      File "/usr/local/lib/python2.7/dist-packages/twisted/web/resource.py", line 250, in render
        return m(request)
      File "server.py", line 46, in render_POST
        pyapns.notify(APP_ID, device_token, {'aps': data})
      File "/src/pyapns/pyapns/client.py", line 265, in wrapper
        return func(*a, **kw)
      File "/src/pyapns/pyapns/client.py", line 256, in wrapper
        return func(*a, **kw)
      File "/src/pyapns/pyapns/client.py", line 289, in notify
        return _xmlrpc_thread(*f_args)
      File "/src/pyapns/pyapns/client.py", line 321, in _xmlrpc_thread
        errback(e)
      File "/src/pyapns/pyapns/client.py", line 254, in errback_wrapper
        errback(e)  # not an instance of UnknownAppID - nothing we can do here
      File "/src/pyapns/pyapns/client.py", line 242, in errback
        raise e
    xmlrpclib.Fault: <Fault 8002: 'error'>
@samuraisam
Copy link
Owner

Are you able to put some breakpoints and some logs in there to see what's going wrong? I don't remember having tested this, but it should be working

@bdoms
Copy link
Author

bdoms commented Jun 13, 2016

I'm not actively working on this project anymore but I can give you some more help. First, this is the line that failed when tokens was a list:

pyapns.notify(APP_ID, tokens, {'aps': data})

And as a workaround to bypass that error, I had to change it to this:

for token in tokens:
    pyapns.notify(APP_ID, token, {'aps': data})

That successfully got around the problem, but not being able to batch is clearly not ideal.

@sachinrekhi
Copy link

I'm running into the exact same issue with pyapns 0.4.1. The iOS push notification works fine when I send a single device token, but no longer works as soon as the device tokens is a list.

Had to employ a similar workaround of sending one at a time as @bdoms suggests. @samuraisam were you able to figure out a fix?

@littlehome-eugene
Copy link

littlehome-eugene commented Jul 19, 2017

Same issue here..

This is the server log.
`
2017-07-19 23:04:15+0900 [Uninitialized] APNSProtocol connectionMade 2017-07-19 23:17:43+0900 [-] "127.0.0.1" - - [19/Jul/2017:14:17:43 +0000] "POST / HTTP/1.1" 200 114 "-" "Python-xmlrpc/3.4" 2017-07-19 23:18:36+0900 [-] "127.0.0.1" - - [19/Jul/2017:14:18:35 +0000] "POST / HTTP/1.1" 200 114 "-" "Python-xmlrpc/3.4" 2017-07-19 23:18:36+0900 [-] "127.0.0.1" - - [19/Jul/2017:14:18:35 +0000] "POST / HTTP/1.1" 200 114 "-" "Python-xmlrpc/3.4" 2017-07-19 23:19:35+0900 [_GenericHTTPChannelProtocol,675,127.0.0.1] Unhandled Error Traceback (most recent call last): File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/twisted/web/server.py", line 183, in process self.render(resrc) File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/twisted/web/server.py", line 234, in render body = resrc.render(self) File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/twisted/web/resource.py", line 250, in render return m(request) File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/twisted/web/xmlrpc.py", line 169, in render_POST d = defer.maybeDeferred(function, *args) --- --- File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/pyapns/server.py", line 293, in xmlrpc_notify aps_dict_or_list)) File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/pyapns/server.py", line 199, in write return client.sendMessage(notifications) File "/home/eugenekim/virtualenvs/zibann/local/lib/python2.7/site-packages/pyapns/server.py", line 77, in sendMessage log.msg('APNSProtocol sendMessage msg=%s' % binascii.hexlify(msg)) exceptions.TypeError: must be string or buffer, not None

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants