本文主要是介绍Wechaty 企业微信机器人启动,token报错:Wechaty service discovery / resolution....,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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.csdn.net/qq_26112725/article/details/136731595
4.官方的社区:https://github.com/wechaty/puppet-supports/issues 这里解决很多常见的问题,例如本文的这个报错,还有企业微信扫码的时候,需要输入验证码的解决方法
这篇关于Wechaty 企业微信机器人启动,token报错:Wechaty service discovery / resolution....的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!