channels: Seeing HTTP/WS send decode error after upgrading to channels 1.1.3

I just upgraded Django channels to 1.1.3 as well as the following related libraries:

channels==1.1.3 daphne==1.2.0 asgi-redis==1.3.0 asgiref==1.1.1

Everything ran fine in my dev environment. But once I pushed to production, installed the new libraries, and completely restarted all services, I immediately started seeing the following error:

ERROR: HTTP/WS send decode error: Cannot dispatch message on channel u'daphne.response.dUTtOgoynk!bNiNpvqevU'

The client was showing the following error:

WebSocket connection to 'wss://<url>.com/' failed: Error during WebSocket handshake: Unexpected response code: 403

When I downgraded to the previous library versions, everything worked fine again.

It appears the issue is during the websocket connect / initial handshake?

I’m using the enforce_ordering decorator on all my websocket consumers as well as the asgi redis back-end.

Any thoughts on what’s going on?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 54 (21 by maintainers)

Most upvoted comments

Hi,

same error - 403 Access Denied, happens every so often. About every 10th request I’d say. Really hard to say what’s wrong.

Here is the Daphne log:

[09/May/2017:08:42:57] "WSCONNECTING /sockets/license/232/" - -
[09/May/2017:08:42:57] "WSREJECT /sockets/license/232/" - -

Installed versions:

Django==1.10.5
daphne==1.2.0
asgi-redis==1.3.0
asgiref==1.1.1
Twisted==17.1.0
channels==1.1.3

Yes, when I remove django-debug-toolbar(and django-debug-toolbar-request-history django-debug-toolbar-template-profiler django-channels-panel), the problem is solved.

I was getting “403 access denied error” when I tried to connect from android app, I have solved with adding Origin header to connect request

OK, I’m going to close this and consider it fixed then. Thanks for getting back to me!