eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa
https://eggjs.org
MIT License
18.91k stars 1.82k forks source link

访问微信登录接口必定报错:nodejs.ClusterClientNoResponseError #3028

Closed JZLeung closed 6 years ago

JZLeung commented 6 years ago
2018-09-20 22:36:17,878 INFO 11795 [-/127.0.0.1/-/0ms GET /passport/weixin?code=061wnHAu1ipVyb0OoYxu1SlzAu1wnHAl&state=http%3A%2F%2Fdushejitang.baishew.com%3A7701%2Fe07931e47c8acdc8e4b5541ec85cafef%3Fts%3D1537454159209] userAuth get sessionToken:  undefined
// 开始请求微信登录接口
wx https://api.weixin.qq.com/sns/oauth2/access_token?appid=xxx&secret=xxx&code=xxx&grant_type=authorization_code
// 超时。此时页面一直在 pendding
2018-09-20 22:37:19,208 ERROR 11221 nodejs.ClusterClientNoResponseError: client no response in 63349ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
    at Timeout.Leader._heartbeatTimer.setInterval [as _onTimeout] (/Users/liangjianzhong/workspace/projects/dushejitang/node_modules/cluster-client/lib/leader.js:74:23)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
name: "ClusterClientNoResponseError"
pid: 11221
hostname: LiangJianzhongdeMacBook-Pro.local
// 这里应该有打印其他 debug 信息的。
// 这里是黄色的提示,无端端又弹出来的日志信息。 此时页面自动重定向。
2018-09-20 22:37:47,875 WARN 11795 [TCPBase] socket is closed by other side while there were still unhandled data in the socket buffer
2018-09-20 22:37:47,876 WARN 11795 [ClusterClient:Watcher] follower closed, and try to init it again
2018-09-20 22:37:47,891 INFO 11795 [-/127.0.0.1/-/1ms GET /e07931e47c8acdc8e4b5541ec85cafef?ts=1537454159209] userAuth get sessionToken:  ttt
2018-09-20 22:37:50,439 INFO 11795 [-/127.0.0.1/-/1ms GET /e07931e47c8acdc8e4b5541ec85cafef/passport/isLogin] userAuth get sessionToken:  ttt
2018-09-20 22:37:52,926 INFO 11795 [-/127.0.0.1/-/0ms GET /e07931e47c8acdc8e4b5541ec85cafef/overview] userAuth get sessionToken:  ttt

image

第一个 console 对应 红色报错前的打印信息。

然后实际执行了后面的却没有打印出信息,但是微信登录时成功的。 image

egg-bot commented 6 years ago

Translation of this issue:


Access to WeChat login interface must be reported error: nodejs.ClusterClientNoResponseError

2018-09-20 22:36:17,878 INFO 11795 [-/127.0.0.1/-/0ms GET /passport/weixin?code=061wnHAu1ipVyb0OoYxu1SlzAu1wnHAl&state=http%3A%2F%2Fdushejitang.baishew.com%3A7701%2Fe07931e47c8acdc8e4b5541ec85cafef%3Fts% 3D1537454159209] userAuth get sessionToken: undefined
// Start requesting WeChat login interface
Wx https://api.weixin.qq.com/sns/oauth2/access_token?appid=xxx&secret=xxx&code=xxx&grant_type=authorization_code
// time out. At this point the page has been pendding
2018-09-20 22:37:19,208 ERROR 11221 nodejs.ClusterClientNoResponseError: client no response in 63349ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
    At Timeout.Leader._heartbeatTimer.setInterval [as _onTimeout] (/Users/liangjianzhong/workspace/projects/dushejitang/node_modules/cluster-client/lib/leader.js:74:23)
    At ontimeout (timers.js:498:11)
    At tryOnTimeout (timers.js:323:5)
    At Timer.listOnTimeout (timers.js:290:5)
Name: "ClusterClientNoResponseError"
Pid: 11221
Hostname: LiangJianzhongdeMacBook-Pro.local
// There should be other debug information printed here.
// Here is the yellow prompt, and the log information popped up from the endless end. The page is now automatically redirected.
2018-09-20 22:37:47,875 WARN 11795 [TCPBase] socket is closed by other side while there were still unhandled data in the socket buffer
2018-09-20 22:37:47,876 WARN 11795 [ClusterClient:Watcher] follower closed, and try to init it again
2018-09-20 22:37:47,891 INFO 11795 [-/127.0.0.1/-/1ms GET /e07931e47c8acdc8e4b5541ec85cafef?ts=1537454159209] userAuth get sessionToken: ttt
2018-09-20 22:37:50,439 INFO 11795 [-/127.0.0.1/-/1ms GET /e07931e47c8acdc8e4b5541ec85cafef/passport/isLogin] userAuth get sessionToken: ttt
2018-09-20 22:37:52,926 INFO 11795 [-/127.0.0.1/-/0ms GET /e07931e47c8acdc8e4b5541ec85cafef/overview] userAuth get sessionToken: ttt

image

The first console corresponds to the print information before the red error.

Then the actual execution of the latter did not print out the information, but the WeChat login was successful. image

thonatos commented 6 years ago
JZLeung commented 6 years ago

无法复现。