Azure Bot Framework仿真器 + Ngrok - 错误:无法启动ngrok。

5
我似乎无法让Azure Bot Framework仿真器与Ngrok一起运作。
环境: - Ubuntu 22.04 - Python3
我遵循的步骤如下: 1. 使用Bot Framework SDK创建机器人 - 在本地仿真器中正常工作。 2. 教程:在Azure中配置机器人。 3. 教程:发布基本机器人 - 使用测试网络聊天在Azure中正常工作。 4. 安装和配置Tunneling(ngrok) - Ngrok的状态页(http://localhost:4040/status)显示它处于在线状态。 - “Ngrok Status Viewer”表明,仿真器中的“隧道状态”是错误的。 - 我在仿真器中收到错误消息:“Failed to spawn ngrok. Please go to the Ngrok Status Viewer and download the log file for a more detailed view of the error.”
{
  "error_code": 102,
  "status_code": 400,
  "msg": "invalid tunnel configuration",
  "details":
    {
      "err": "yaml: unmarshal errors:\n line 1: field region not found in type config.HTTPv2Tunnel\n line 1: field path not found in type config.HTTPv2Tunnel",
    },
}

输入图像说明


编辑1:根据@sairamtadepalli-mt的建议

如果我在配置文件中更改Ngrok的端口(web_addr),我会得到一个新的错误:

Connecting to bot on https://XXX.azurewebsites.net/api/messages
ngrok reconnected.
ngrok listening on http://localhost:36599
ngrok traffic inspector:
Will bypass ngrok for local addresses
Failed to spawn ngrok. Please go to the Ngrok Status Viewer and download the log file for a more detailed view of the error.
Error: The bot is remote, but the service URL is localhost. Without tunneling software you will not receive replies.
Connecting to bots hosted remotely
Configure ngrok

编辑2:根据@sairamtadepalli-mt的建议:

这是我在“状态查看器”和控制台中看到的内容(仍然是最初的错误...):

输入图像描述

“Ngrok状态查看器”中的错误信息: 似乎ngrok隧道已不复存在。尝试重新连接到Ngrok,或检查日志以获取详细错误说明。

输入图像描述

控制台中的错误信息:

Failed to spawn ngrok Error: {"error_code":102,"status_code":400,"msg":"invalid tunnel configuration","details":{"err":"yaml: unmarshal errors:\n  line 1: field region not found in type config.HTTPv2Tunnel\n  line 1: field path not found in type config.HTTPv2Tunnel"}}

    at NgrokInstance.runTunnel (/tmp/.mount_BotFraqqaRh3/resources/app.asar/app/server/ngrok.js:257:17)
    at async NgrokInstance.connect (/tmp/.mount_BotFraqqaRh3/resources/app.asar/app/server/ngrok.js:120:24)
    at async /tmp/.mount_BotFraqqaRh3/resources/app.asar/app/server/ngrokService.js:165:15


3个回答

11

我在使用Ngrok v3的Win10电脑上遇到了与您相同的问题。 我尝试使用yaml文件配置隧道等多种方法,但都没有成功。

最终,我从这个链接下载了Ngrok版本2.3.40:ngrok releases

现在一切都正常工作了。希望这可以帮到您。


2

目前,请使用ngrok版本2而非3来作为机器人仿真器的工具。我已经安装了2.3.40版本,正如@cdiazal所提到的那样,可以使其正常运行。

目前还没有更新使仿真器与ngrok 3兼容的信息。

在此处阅读有关此问题的讨论线程:https://github.com/microsoft/BotFramework-Emulator/issues/2389


0

问题已经复现,解决问题所需的更改有两个。

解决方案1:

发现:从问题截图中得出的主要发现是,ngrok的隧道软件未正确安装。虽然您已经完成了安装,但需要从端口方面更改配置。

解决方案:重新从头安装隧道软件。

解决方案2:

发现:当模拟器无法加载和启动所需操作时,这意味着正在尝试连接的Post已经在使用中。当它尝试连接到新端口时,问题将发生。

请按照以下链接在Linux机器上安装和配置Ngrok。

https://ngrok.com/download

配置未使用的端口。检查4040端口是否被Web服务器使用。如果正在使用,则将端口更改为4041,然后重新启动模拟器并检查连接。


感谢 @sairamtadepalli-mt! 我刚刚通过 apt 卸载并重新安装了 Ngrok(curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok),但即使在计算机重启后仍然存在相同的问题。 - fleuryc
你所说的“配置未使用的端口”具体是什么意思?我该如何操作? - fleuryc
我也尝试使用 snapsnap install ngrok)进行清除和重新安装。但是问题依旧。 - fleuryc
请查看此链接以更改端口号:https://dev59.com/uFoV5IYBdhLWcg3wnf7r - Sairam Tadepalli
请参考问题描述中的新内容。我找不到“下载日志文件”的位置/方式(没有按钮或链接...)。在stdout中显示的错误消息是:Failed to spawn ngrok Error: {"error_code":102,"status_code":400,"msg":"invalid tunnel configuration","details":{"err":"yaml: unmarshal errors:\n line 1: field region not found in type config.HTTPv2Tunnel\n line 1: field path not found in type config.HTTPv2Tunnel"}} - fleuryc
显示剩余4条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接