Flask Socket-IO misses current_user with request from NGROK -
i got flask app running @ house normally. no error ever. uses flask-socketio , flask login. since started use ngrok, have noticed weird. whenever make request outside home network error below. seems login-in anonymous user, not because logged in. @ home not happen. have debugged , http requests current_user fine, reason socket-io doesnt. using nginx reverse proxy, have tested without nginx binding ngrok straight flask server port (both development , gunicorn).
traceback (most recent call last): file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run result = self._run(*self.args, **self.kwargs) file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/socketio/virtsocket.py", line 403, in _receiver_loop retval = pkt_ns.process_packet(pkt) file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/socketio/namespace.py", line 164, in process_packet return self.call_method_with_acl('recv_connect', packet) file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/socketio/namespace.py", line 240, in call_method_with_acl return self.call_method(method_name, packet, *args) file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/socketio/namespace.py", line 282, in call_method return method(*args) file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/flask_socketio/__init__.py", line 89, in recv_connect self.socketio._dispatch_message(app, self, 'connect') file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/flask_socketio/__init__.py", line 160, in _dispatch_message ret = self.messages[namespace.ns_name][message](*args) file "/home/cesco/projects/power/app/socket/socket_controllers.py", line 105, in test_connect print('client ' + str(current_user.username) + ' connected socket') file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/werkzeug/local.py", line 338, in __getattr__ return getattr(self._get_current_object(), name) attributeerror: 'anonymoususermixin' object has no attribute 'username'
pip freeze
authomatic==0.0.13 flask==0.10.1 flask-bootstrap==3.3.2.1 flask-httpauth==2.5.0 flask-login==0.2.11 flask-mail==0.9.1 flask-migrate==1.4.0 flask-sqlalchemy==2.0 flask-script==2.0.5 flask-socketio==0.6.0 flask-triangle==0.5.4 flask-wtf==0.11 jinja2==2.7.3 mako==1.0.1 markupsafe==0.23 sqlalchemy==1.0.3 wtforms==2.0.2 werkzeug==0.10.4 alembic==0.7.6 amqp==1.4.6 anyjson==0.3.3 argparse==1.2.1 billiard==3.3.0.20 blinker==1.3 celery==3.1.18 gevent==1.0.1 gevent-socketio==0.3.6 gevent-websocket==0.9.3 greenlet==0.4.6 gunicorn==18.0 itsdangerous==0.24 jsonschema==2.4.0 kombu==3.0.26 pyserial==2.7 python-openid==2.2.5 pytz==2015.4 simplejson==3.8.0 wheel==0.24.0 wsgiref==0.1.2
Comments
Post a Comment