wechaty/wechaty-puppet-padchat

服务器迁移之后报 Error: Unexpected server response: 426

Closed this issue · 3 comments

0. Report Issue Guide

Please search in the issue first, and make sure your problem had not been reported before.

1. Expected behavior

服务器升级之后,我将padchat的版本升级到最新0.17.18,希望登录成功

2. Actual behavior

但是启动bot报错,如下:
image
image
image

3. Steps to reproduce your problem (and fixes, if any)

复现就是按照迁移文档将padchat版本升级到0.17.18之后,再启动bot,直接报上面的错误。

4. Full Output Logs

Show Logs
$ WECHATY_LOG=silly node yourbot.js

Question: Paste your FULL(DO NOT ONLY PROVIDE FRAGMENTS) log messages
Answer:

I can not reproduce your issue, here is my package.json

{
  "name": "new",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@babel/runtime": "^7.0.0-beta.39",
    "qrcode-terminal": "^0.12.0",
    "wechaty": "^0.23.17",
    "wechaty-puppet-padchat": "^0.17.18"
  }
}

And here is my bot.ts file

import { Wechaty, Message } from 'wechaty';
import { generate } from 'qrcode-terminal';
import { PuppetPadchat } from 'wechaty-puppet-padchat';

const puppet = new PuppetPadchat({
  token: 'my-token'
});

const bot = new Wechaty({
  puppet
});

bot
.on('scan', (qrcode, status) => {
  generate(qrcode, { small: true })

  const qrcodeImageUrl = [
    'https://api.qrserver.com/v1/create-qr-code/?data=',
    encodeURIComponent(qrcode),
  ].join('')

  console.log(`[${status}] ${qrcodeImageUrl}\nScan QR Code above to log in: `)
})
.on('login', async user => {
  console.log(`Login: ${user}`);
})
.on('message', async (message: Message) => {
  console.log(message.date())
})
.start()

npm version 6.1.0
node version 10.8.0

My full log

16:52:48 INFO Config registering process.on("unhandledRejection") for development/debug
16:52:48 VERB Config constructor()
16:52:48 VERB Puppet constructor({"timeout":240,"token":"my-token"}) #0
16:52:48 VERB StateSwitch constructor(name=PuppetPadchat)
16:52:48 VERB MemoryCard constructor(undefined)
16:52:48 VERB MemoryCard getStorage() for storage type: N/A
16:52:48 VERB MemoryCard load() from storage: N/A
16:52:48 VERB MemoryCard load() no storage
16:52:48 VERB Puppet constructor() watchdog timeout set to 240 seconds
16:52:48 VERB HotImport callerResolve(., /Users/yuangao/docker-dev/new/node_modules/wechaty-puppet/dist/src/puppet.js)
16:52:48 SILL HotImport callerResolve() callsites() file=/Users/yuangao/docker-dev/new/node_modules/hot-import/dist/src/hot-import.js, type=Object
16:52:48 SILL HotImport callerResolve() callsites() file=/Users/yuangao/docker-dev/new/node_modules/wechaty-puppet/dist/src/puppet.js, type=null
16:52:48 SILL HotImport callerResolve() callsites() file=/Users/yuangao/docker-dev/new/node_modules/wechaty-puppet-padchat/dist/src/puppet-padchat.js, type=null
16:52:48 SILL HotImport callerResolve() callerFile=/Users/yuangao/docker-dev/new/node_modules/wechaty-puppet-padchat/dist/src/puppet-padchat.js
16:52:48 VERB Puppet constructor() childClassPath=/Users/yuangao/docker-dev/new/node_modules/wechaty-puppet-padchat/dist/src
16:52:48 SILL Accessory #0<Wechaty> constructor()
16:52:48 VERB Wechaty contructor()
16:52:48 VERB StateSwitch constructor(name=Wechaty)
16:52:48 VERB StateSwitch constructor(name=WechatyReady)
16:52:48 VERB Wechaty on(scan, function) registered
16:52:48 VERB Wechaty onFunction(scan)
16:52:48 VERB Wechaty on(login, function) registered
16:52:48 VERB Wechaty onFunction(login)
16:52:48 VERB Wechaty on(message, function) registered
16:52:48 VERB Wechaty onFunction(message)
16:52:48 VERB Wechaty on(room-leave, function) registered
16:52:48 VERB Wechaty onFunction(room-leave)
16:52:48 VERB Wechaty on(room-invite, function) registered
16:52:48 VERB Wechaty onFunction(room-invite)
16:52:48 VERB Wechaty on(logout, function) registered
16:52:48 VERB Wechaty onFunction(logout)
16:52:48 SILL Wechaty version() form development environment is not availble: ENOENT: no such file or directory, stat '/Users/yuangao/docker-dev/new/node_modules/wechaty/dist/.git'
16:52:48 INFO Wechaty <Puppet#0<PuppetPadchat>()/PuppetPadchat#0> start() v0.23.17 is starting...
16:52:48 VERB Wechaty puppet: Puppet#0<PuppetPadchat>()/PuppetPadchat#0
16:52:48 VERB Wechaty profile: undefined
16:52:48 VERB Wechaty id: cjncx52350000wrs6gd7t8p21
16:52:48 SILL StateSwitch <Wechaty> on() is false
16:52:48 SILL StateSwitch <WechatyReady> off() is true
16:52:48 VERB StateSwitch <WechatyReady> off(true) <- (true)
16:52:48 SILL StateSwitch <Wechaty> on() is false
16:52:48 VERB StateSwitch <Wechaty> on(pending) <- (false)
16:52:48 VERB MemoryCard constructor(undefined)
16:52:48 VERB MemoryCard getStorage() for storage type: N/A
16:52:48 VERB MemoryCard load() from storage: N/A
16:52:48 VERB MemoryCard load() no storage
(node:85419) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
16:52:48 VERB Puppet constructor() memory.load() done
16:52:48 VERB Wechaty initPuppet() Puppet#0<PuppetPadchat>()/PuppetPadchat#0
16:52:48 VERB MemoryCard multiplex(puppet)
16:52:48 VERB MemoryCard static multiplex(MemoryCard<>, puppet)
16:52:48 VERB MemoryCard constructor({"multiplex":{"name":"puppet","parent":{"payload":{},"multiplexNameList":[]}}})
16:52:48 VERB PuppetManager resolve({puppet: Puppet#0<PuppetPadchat>()/PuppetPadchat#0, puppetOptions: undefined})
16:52:48 VERB PuppetManager resolveInstance(Puppet#0<PuppetPadchat>()/PuppetPadchat#0)
16:52:48 VERB Puppet setMemory()
16:52:48 VERB Wechaty initPuppetEventBridge(Puppet#0<PuppetPadchat>()/PuppetPadchat#0)
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(friendship) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(login) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(logout) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(message) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(room-invite) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(room-join) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(room-leave) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(room-topic) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(scan) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(dong) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(error) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(ready) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(reset) registered
16:52:48 VERB Wechaty initPuppetEventBridge() puppet.on(watchdog) registered
16:52:48 VERB Wechaty initAccessory(Puppet#0<PuppetPadchat>()/PuppetPadchat#0)
16:52:48 SILL Accessory <Contact> static set wechaty = "Wechaty#cjncx52350000wrs6gd7t8p21<Puppet#0<PuppetPadchat>()/PuppetPadchat#0>()"
16:52:48 SILL Accessory <ContactSelf> static set wechaty = "Wechaty#cjncx52350000wrs6gd7t8p21<Puppet#0<PuppetPadchat>()/PuppetPadchat#0>()"
16:52:48 SILL Accessory <Friendship> static set wechaty = "Wechaty#cjncx52350000wrs6gd7t8p21<Puppet#0<PuppetPadchat>()/PuppetPadchat#0>()"
16:52:48 SILL Accessory <Message> static set wechaty = "Wechaty#cjncx52350000wrs6gd7t8p21<Puppet#0<PuppetPadchat>()/PuppetPadchat#0>()"
16:52:48 SILL Accessory <Room> static set wechaty = "Wechaty#cjncx52350000wrs6gd7t8p21<Puppet#0<PuppetPadchat>()/PuppetPadchat#0>()"
16:52:48 SILL Accessory <RoomInvitation> static set wechaty = "Wechaty#cjncx52350000wrs6gd7t8p21<Puppet#0<PuppetPadchat>()/PuppetPadchat#0>()"
16:52:48 SILL Accessory <Contact> static set puppet = "Puppet#0<PuppetPadchat>()/PuppetPadchat#0"
16:52:48 SILL Accessory <ContactSelf> static set puppet = "Puppet#0<PuppetPadchat>()/PuppetPadchat#0"
16:52:48 SILL Accessory <Friendship> static set puppet = "Puppet#0<PuppetPadchat>()/PuppetPadchat#0"
16:52:48 SILL Accessory <Message> static set puppet = "Puppet#0<PuppetPadchat>()/PuppetPadchat#0"
16:52:48 SILL Accessory <Room> static set puppet = "Puppet#0<PuppetPadchat>()/PuppetPadchat#0"
16:52:48 SILL Accessory <RoomInvitation> static set puppet = "Puppet#0<PuppetPadchat>()/PuppetPadchat#0"
16:52:48 SILL Accessory <Wechaty> set puppet = "Puppet#0<PuppetPadchat>()/PuppetPadchat#0"
16:52:48 VERB PuppetPadchat start() with undefined
16:52:48 SILL StateSwitch <PuppetPadchat> on() is false
16:52:48 SILL StateSwitch <PuppetPadchat> on() is false
16:52:48 VERB StateSwitch <PuppetPadchat> on(pending) <- (false)
16:52:48 VERB PadchatRpc constructor(ws://padchat.botorange.com/wx, token)
16:52:48 VERB PuppetPadchatManager constructor()
16:52:48 VERB PuppetPadchat startManager()
16:52:48 SILL StateSwitch <PuppetPadchat> off() is false
16:52:48 VERB PuppetPadchatManager start()
16:52:48 VERB PadchatRpc start()
16:52:48 VERB PadchatRpc initWebSocket()
16:52:49 SILL PadchatRpc initWebSocket() Promise() ws.on(open)
16:52:49 VERB PadchatRpc initJsonRpc()
16:52:49 VERB PadchatRpc startQueues()
16:52:49 VERB PadchatRpc initHeartbeat()
16:52:49 SILL PadchatRpc rpcCall(init, [])
16:52:49 SILL PadchatRpc pre login rpcCall(init, [])
16:52:49 SILL PadchatRpc initWebSocket() ws.on(message): {"apiName":"init","data":"%7B%22message%22%3A%22%E5%88%9D%E5%A7%8B%E5%8C%96%E8%BF%9E%E6%8E%A5%E6%88%
16:52:49 SILL PadchatRpc init result: {"message":"初始化连接成功","status":0}
16:52:49 VERB PadchatRpc WXInitialize()
16:52:49 SILL PadchatRpc rpcCall(WXInitialize, [])
16:52:49 SILL PadchatRpc pre login rpcCall(WXInitialize, [])
16:52:49 SILL PadchatRpc initWebSocket() ws.on(message): {"apiName":"WXInitialize","data":"%7B%22message%22%3A%22%E5%88%9D%E5%A7%8B%E5%8C%96%E5%BE%AE%E4%BF%A
16:52:49 SILL PadchatRpc WXInitialize result: {"message":"初始化微信信息成功","status":0}
16:52:49 VERB MemoryCard <puppet> get(WECHATY_PUPPET_PADCHAT)
16:52:49 VERB PuppetPadchatManager tryLoad62Data()
16:52:49 SILL PuppetPadchatManager tryLoad62Data() 62 data not found
16:52:49 VERB PuppetPadchatManager tryAutoLogin(undefined)
16:52:49 SILL PuppetPadchatManager tryAutoLogin() currentUserId not found in memorySlot
16:52:49 VERB PuppetPadchatManager startCheckScan()
16:52:49 SILL PuppetPadchatManager startCheckScan() checkScanInternalLoop()
16:52:49 SILL PadchatRpc rpcCall(WXCheckQRCode, [])
16:52:49 SILL PadchatRpc pre login rpcCall(WXCheckQRCode, [])
16:52:49 SILL PuppetPadchatManager startCheckScan() checkScanInternalLoop() set
16:52:49 VERB PuppetPadchat startWatchdog()
16:52:49 SILL StateSwitch <PuppetPadchat> on() is pending
16:52:49 VERB StateSwitch <PuppetPadchat> on(true) <- (pending)
16:52:49 VERB Wechaty on(heartbeat, function) registered
16:52:49 VERB Wechaty onFunction(heartbeat)
16:52:49 SILL StateSwitch <Wechaty> on() is pending
16:52:49 VERB StateSwitch <Wechaty> on(true) <- (pending)
16:52:49 SILL PadchatRpc initWebSocket() ws.on(message): {"apiName":"WXCheckQRCode","data":"%7B%22expired_time%22%3A0%2C%22status%22%3A-2%7D%0A","msgId":"-90
16:52:49 SILL PadchatRpc WXCheckQRCode result: {"expired_time":0,"status":-2}
16:52:49 SILL PuppetPadchatManager ignore status -2
16:52:50 VERB PuppetPadchatManager emitLoginQrCode()
16:52:50 SILL PadchatRpc rpcCall(WXGetQRCode, [])
16:52:50 SILL PadchatRpc pre login rpcCall(WXGetQRCode, [])
16:52:50 SILL PadchatRpc initWebSocket() ws.on(message): {"apiName":"WXGetQRCode","data":"%7B%22qr_code%22%3A%22%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAMCAgM
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █ ▄▄ █▀ ██▀ █▄█ ▄▄▄▄▄ █
█ █   █ ██▄█▀▀ █ ▄▄▀  █ █   █ █
█ █▄▄▄█ █ ▀▀▄ ▄███▄██▀█ █▄▄▄█ █
█▄▄▄▄▄▄▄█ ▀▄█▄█ ▀▄█ ▀ █▄▄▄▄▄▄▄█
█   █▀ ▄█▄▄█▄ ▀▀▄ ██▀▄▄  ▄██  █
█▀▄▄▄▀ ▄▀ ▄ ▀ ▄▄ █▄ ▄▀█▀█ ▄▄█▄█
██▀▄█▀▀▄█▀  ████▄ █▀▀ ▄  ██▀▀ █
█▀▄▀ █▀▄▀▄▀ ▄██▀ ▄▄█ ▀█▀▄ ▄██▄█
██ ▀██▀▄ ▄▀ ▄ ██▄▀█▀▀ ▀ ▀█ ▀▀ █
█▄▄▄▀██▄  ▀ ▀ ▄█▄ ██ █ ▄█ ███▄█
█▄▄▄▄█▄▄█▀ ▄██▀▀█ ▄▀▄ ▄▄▄  ▀▄▀█
█ ▄▄▄▄▄ █▀█ ▄██▄ ▄█ ▀ █▄█ ▀█▀ █
█ █   █ ██▀▄▄ █▀  ██▄  ▄▄ ▀█▄▀█
█ █▄▄▄█ █  █▀ ██▄██▀█▀██▀▄▀█▄▄█
█▄▄▄▄▄▄▄█▄▄▄█▄▄▄▄▄██▄▄█▄█▄▄██▄█

[0] https://api.qrserver.com/v1/create-qr-code/?data=http%3A%2F%2Fweixin.qq.com%2Fx%2FQatvSgabLRCBho1xgdzv
Scan QR Code above to log in:
16:52:50 SILL PuppetPadchatManager startCheckScan() checkScanInternalLoop() resolved
16:52:51 SILL PuppetPadchatManager startCheckScan() checkScanInternalLoop()
16:52:51 SILL PadchatRpc rpcCall(WXCheckQRCode, [])
16:52:51 SILL PadchatRpc pre login rpcCall(WXCheckQRCode, [])
16:52:51 SILL PadchatRpc initWebSocket() ws.on(message): {"apiName":"WXCheckQRCode","data":"%7B%22expired_time%22%3A239%2C%22status%22%3A0%7D%0A","msgId":"-9
16:52:51 SILL PadchatRpc WXCheckQRCode result: {"expired_time":239,"status":0}
16:52:51 SILL PuppetPadchatManager checkQrcode: Please scan the Qrcode!

Please verify your environment and package versions. Try with minimal reproducable code to reproduce the issue, if you can, please paste your code in the comment. We can not debug your issue if we can not reproduce your situation.

没有复现我的问题 那我都把详细的log打印出来了 能看出来我的问题出在哪了吗??我这边bot确实是起不来了啊。。

解决了 删除node_modules重新install了一下就好了