007gzs/meeting

可以正确进入django管理后台,but 小程序里 爆了socket500 error

cww97 opened this issue · 22 comments

cww97 commented
WebSocket connection to 'ws://172.29.222.92:8000/wsapi' failed: Error during WebSocket handshake: Unexpected response code: 500
WebSocket connection to 'ws://172.29.222.92:8000/wsapi' failed: WebSocket is closed before the connection is established.

django后台报了这个error

ERROR server.application_checker Exception inside application: object.__init__() takes no parameters
Traceback (most recent call last):
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/routing.py", line 71, in __call__
    return await application(scope, receive, send)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/sessions.py", line 47, in __call__
    return await self.inner(dict(scope, cookies=cookies), receive, send)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/sessions.py", line 172, in __call__
    return await self.inner(self.scope, receive, self.send)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/auth.py", line 181, in __call__
    return await super().__call__(scope, receive, send)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/middleware.py", line 26, in __call__
    return await self.inner(scope, receive, send)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/routing.py", line 160, in __call__
    send,
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/asgiref/compatibility.py", line 33, in new_application
    instance = application(scope)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/generic/websocket.py", line 23, in __init__
    super().__init__(*args, **kwargs)
TypeError: object.__init__() takes no parameters
cww97 commented

小程序在win上调试,server开在了同内网下的ubuntu下,不知道这个会不会是原因。but,在win下访问django管理后台无问题

channels 3.0的兼容问题,最新版本已做处理

cww97 commented

server端pull了新的code,再次刷新小程序里,

Uncaught (in promise) thirdScriptError
"网络错误"
String

此时django后台报错

ERROR server.application_checker Exception inside application: ERR unknown command 'BZPOPMIN'
Traceback (most recent call last):
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/sessions.py", line 183, in __call__
    return await self.inner(receive, self.send)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/middleware.py", line 41, in coroutine_call
    await inner_instance(receive, send)
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/consumer.py", line 59, in __call__
    [receive, self.channel_receive], self.dispatch
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/utils.py", line 58, in await_many_dispatch
    await task
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels/utils.py", line 50, in await_many_dispatch
    result = task.result()
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels_redis/core.py", line 469, in receive
    real_channel
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels_redis/core.py", line 524, in receive_single
    index, channel_key, timeout=self.brpop_timeout
  File "/home/weiwen/anaconda3/envs/meeting/lib/python3.6/site-packages/channels_redis/core.py", line 361, in _brpop_with_clean
    result = await connection.bzpopmin(channel, timeout=timeout)
aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'

改装了2.4版本的channels依然没有改变

cww97 commented

from here,似乎

pip install channels-redis==2.4.2

了之后好了

cww97 commented

创建会议室后并没有返回上一页。

手动返回上一步点开该会议室后,又报了参数错误

VM274 WAService.js:2 Uncaught (in promise) thirdScriptError
"参数错误"
String
errorReport @ VM274 WAService.js:2
thirdErrorReport @ VM274 WAService.js:2
(anonymous) @ VM274 WAService.js:2
c @ VM274 WAService.js:2
i @ VM274 WAService.js:2
(anonymous) @ VM274 WAService.js:2
value @ VM274 WAService.js:2
t @ VM274 WAService.js:2
(anonymous) @ VM274 WAService.js:2
cww97 commented

参数错误一直报,创建会议和预约会议之后不会正确返回,but可以正确创建
功能基本能正常使用,只是控制台里一直在报参数错误,没法正确返回也怪难受的

cww97 commented

进入db后台看qr_code是空的,怀疑是二维码没有创建成功,可能是哪里引起的呢

cww97 commented

请问是否可以提供一个,您成功运行的环境中各种python包的具体版本号,以及sql与redis的具体版本号
运行发现request meeting可以成功,request room的info没有返回结果
报错全在底层

cww97 commented

http://xx.xx.xx.xx/api/meeting/room/info?room_id=2

使用api调试的时候,发现

HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "code": -11,
    "message": "参数错误",
    "data": {
        "errors": {
            "meeting_id": [
                "该字段是必填项。"
            ]
        }
    }
}

为什么会出现,查room的info的时候需要填写meeting_id的情况

cww97 commented

以及api调试的时候提示需要登录该如何临时解决

cww97 commented

我注释了检测登录的两行

调试http://xx.xx.xx.xx/api/meeting/room/info?room_id=2

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/channels/http.py", line 192, in __call__
    await self.handle(body_stream)
  File "/usr/local/lib/python3.8/dist-packages/asgiref/sync.py", line 304, in __call__
    ret = await asyncio.wait_for(future, timeout=None)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 455, in wait_for
    return await fut
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/asgiref/sync.py", line 343, in thread_handler
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/channels/http.py", line 244, in handle
    response = self.get_response(request)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py", line 75, in get_response
    response = self._middleware_chain(request)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py", line 36, in inner
    response = response_for_exception(request, exc)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py", line 91, in response_for_exception
    log_response(
  File "/usr/local/lib/python3.8/dist-packages/django/utils/log.py", line 222, in log_response
    getattr(logger, level)(
  File "/usr/lib/python3.8/logging/__init__.py", line 1463, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log
    self.handle(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 1587, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 1649, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 950, in handle
    self.emit(record)
  File "/usr/local/lib/python3.8/dist-packages/django/utils/log.py", line 122, in emit
    self.send_mail(subject, message, fail_silently=True, html_message=html_message)
  File "/usr/local/lib/python3.8/dist-packages/django/utils/log.py", line 125, in send_mail
    mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/__init__.py", line 101, in mail_admins
    mail.send(fail_silently=fail_silently)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/message.py", line 291, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/backends/smtp.py", line 110, in send_messages
    sent = self._send(message)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/backends/smtp.py", line 122, in _send
    from_email = sanitize_address(email_message.from_email, encoding)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/message.py", line 119, in sanitize_address
    address = Address(nm, addr_spec=addr)
  File "/usr/lib/python3.8/email/headerregistry.py", line 42, in __init__
    a_s, rest = parser.get_addr_spec(addr_spec)
  File "/usr/lib/python3.8/email/_header_value_parser.py", line 1631, in get_addr_spec
    token, value = get_local_part(value)
  File "/usr/lib/python3.8/email/_header_value_parser.py", line 1441, in get_local_part
    if value[0] in CFWS_LEADER:
IndexError: string index out of range

http://xx.xx.xx.xx/api/meeting/room/info?room_id=2

使用api调试的时候,发现

HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "code": -11,
    "message": "参数错误",
    "data": {
        "errors": {
            "meeting_id": [
                "该字段是必填项。"
            ]
        }
    }
}

为什么会出现,查room的info的时候需要填写meeting_id的情况

这个我看着也不对,但不知道为什么我线上环境竟然还能用。。你把RoomBase里的meeting_id改成room_id先试下把

以及api调试的时候提示需要登录该如何临时解决

最好从开发者工具里复制cookies测试

我注释了检测登录的两行

调试http://xx.xx.xx.xx/api/meeting/room/info?room_id=2

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/channels/http.py", line 192, in __call__
    await self.handle(body_stream)
  File "/usr/local/lib/python3.8/dist-packages/asgiref/sync.py", line 304, in __call__
    ret = await asyncio.wait_for(future, timeout=None)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 455, in wait_for
    return await fut
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/asgiref/sync.py", line 343, in thread_handler
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/channels/http.py", line 244, in handle
    response = self.get_response(request)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py", line 75, in get_response
    response = self._middleware_chain(request)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py", line 36, in inner
    response = response_for_exception(request, exc)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py", line 91, in response_for_exception
    log_response(
  File "/usr/local/lib/python3.8/dist-packages/django/utils/log.py", line 222, in log_response
    getattr(logger, level)(
  File "/usr/lib/python3.8/logging/__init__.py", line 1463, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log
    self.handle(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 1587, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 1649, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 950, in handle
    self.emit(record)
  File "/usr/local/lib/python3.8/dist-packages/django/utils/log.py", line 122, in emit
    self.send_mail(subject, message, fail_silently=True, html_message=html_message)
  File "/usr/local/lib/python3.8/dist-packages/django/utils/log.py", line 125, in send_mail
    mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/__init__.py", line 101, in mail_admins
    mail.send(fail_silently=fail_silently)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/message.py", line 291, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/backends/smtp.py", line 110, in send_messages
    sent = self._send(message)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/backends/smtp.py", line 122, in _send
    from_email = sanitize_address(email_message.from_email, encoding)
  File "/usr/local/lib/python3.8/dist-packages/django/core/mail/message.py", line 119, in sanitize_address
    address = Address(nm, addr_spec=addr)
  File "/usr/lib/python3.8/email/headerregistry.py", line 42, in __init__
    a_s, rest = parser.get_addr_spec(addr_spec)
  File "/usr/lib/python3.8/email/_header_value_parser.py", line 1631, in get_addr_spec
    token, value = get_local_part(value)
  File "/usr/lib/python3.8/email/_header_value_parser.py", line 1441, in get_local_part
    if value[0] in CFWS_LEADER:
IndexError: string index out of range

这个是500的时候发邮件出错了,删除local_settings.py里邮件相关设置就可以

cww97 commented

http://xx.xx.xx.xx/api/meeting/room/info?room_id=2
使用api调试的时候,发现

HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "code": -11,
    "message": "参数错误",
    "data": {
        "errors": {
            "meeting_id": [
                "该字段是必填项。"
            ]
        }
    }
}

为什么会出现,查room的info的时候需要填写meeting_id的情况

这个我看着也不对,但不知道为什么我线上环境竟然还能用。。你把RoomBase里的meeting_id改成room_id先试下把

改了这一行之后能用了,虽然依然没有room的二维码,but核心报错已经搞定了,console里还没有爆红

by the way

请问开发者工具里的cookies在哪测试(捂脸

感觉很多小bug是小版本号的微小差异引起的,why not 提供一下线上环境的 os, sql, redis, pip包的各种小版本号?
这种小兼容没必要一个个修啊,docker一键运行有、香

我现在没电脑,你可以帮忙提交个pr

cww97 commented

我现在没电脑,你可以帮忙提交个pr

rua

8过,线上环境到底发生了啥(捂脸

同样,在win下小程序开发模拟器可以使用,但不停弹参数错误,在手机上无论真机调试还是上传测试版都是网络错误无法使用,很迷

from here,似乎

pip install channels-redis==2.4.2

了之后好了

遇到所有和您一样的问题,使用之后好了。
这个qr码还是不行。
同时,在模拟器里和在真机调试正常。发布体验版显示网络错误

微信现在要求使用https连接。然而django还是http

微信现在要求使用https连接。然而django还是http

我换用了https连接,但是并没有解决问题