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 这里解决很多常见的问题,例如本文的这个报错,还有企业微信扫码的时候,需要输入验证码的解决方法

  • 10
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值