1.报错
Wechaty service discovery / resolution failed for target wechaty://api.chatie.io/puppet_workpro_xxxx: token "puppet_workpro_xxxx" does not exist
或者
Failed to parse DNS address dns:wechaty://token-service-discovery-test.juzibot.com /puppet_workpro_xxxx
2.我使用的环境
"file-box": "^1.5.5",
"qrcode": "^1.5.3",
"install": "^0.13.0",
"@grpc/grpc-js": "^1.10.1","@juzi/wechaty": "^1.0.65",
"@juzi/wechaty-puppet": "^1.0.61",
"@juzi/wechaty-puppet-service": "^1.0.69","wechaty-puppet-official-account": "^1.10.7",
"wechaty-puppet-padlocal": "^1.20.1",
"wechaty": "^1.20.2","wechaty-puppet-wechat4u": "^1.14.14"
3.解决方法
1.设置环境变量:
WECHATY_PUPPET_SERVICE_AUTHORITY=token-service-discovery-test.juzibot.com
2.构建机器人用下面代码:
const {WechatyBuilder} = require("@juzi/wechaty"); let puppet = WechatyBuilder.build({ name: 'your-bot-name', // 配置name会保存登录信息,可以在调试的时候,只要登录之后不退出登录,就可以重复登录 puppet: '@juzi/wechaty-puppet-service', puppetOptions: { authority: 'token-service-discovery-test.juzibot.com', tls: { disable: true }, token: configApi.wxSet.enterpriseWechatToken, // 将你的 token 填写在此,它应该形式类似于 'puppet_workpro_xxxxxx' } });
3.如果启动的时候,出现:return ‘port‘ in address ,可以看下我写的这个文章:https://blog.youkuaiyun.com/qq_26112725/article/details/136731595
4.官方的社区:https://github.com/wechaty/puppet-supports/issues 这里解决很多常见的问题,例如本文的这个报错,还有企业微信扫码的时候,需要输入验证码的解决方法