vps 上部署 slack app 但是在 slack 上显示“Your URL didn't respond”,求教这个该怎么排查和解决

2023-04-05 10:28:33 +08:00
 ningyu
最近看到 github 上的 myGPTReader ,刚好自己有台 vps ( vps 是搬瓦工的),想自己用 docker 部署一个,参考这个安装文档: https://github.com/madawei2699/myGPTReader/blob/main/docs/how-to-install/docker.md
但是最后在“https://api.slack.com/apps/A051D7ERKH9/event-subscriptions?”上输入 url 显示“Your URL didn't respond”,求教一下这个该如何排查?

我在这个 repo 下面也提问了,但是没人回答,我自己看了 docker 起的进程什么的都是有的,端口也是打开的,下面就不知道怎么排查了。。。

由于这边不能发图片,我在 repo 上的提问贴了一些图片,麻烦有懂的大神帮忙看下,多谢~~

我在 repo 上的提问链接: https://github.com/madawei2699/myGPTReader/issues/31
1073 次点击
所在节点    Docker
9 条回复
jackyzy823
2023-04-05 10:45:16 +08:00
外部(如本地电脑)能访问 这个 URL 吗?如果不能,可能是 VPS 上防火墙没有放行这个端口。
ningyu
2023-04-05 11:47:33 +08:00
@jackyzy823 多谢解答~
1. 我在 vps 机器上我执行过这个命令
curl -X POST -H "Content-type: application/json" -d '{"text":"Hello, world!"}' http://localhost:8080/slack/events
但是返回的是 invalid request
{"error": "invalid request"}

2. 然后在我自己的电脑浏览器上访问"http://ip:8080/slack/events",提示“Method Not Allowed”错误

3. vps 上的防火墙我已经关闭掉了,ufw status 输出的是“Status: inactive”

从上面第 3 点是不是可以排除“防火墙没有放行这个端口”的原因,1 和 3 都有问题是不是说明我的服务有问题,虽然进程起来了,但是好像并没有监听到 8080 端口,如果是这样的话该咋处理呢


补充下相关信息:

我的 docker-compose ps 命令的输出:

root@sweet-kitten-1:~/myGPTReader_config# docker-compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mygptreader_config-web-1 gptreader:lastest "gunicorn app.server…" web 12 hours ago Up 12 hours 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp

lsof -i:8080 的输出:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 39309 root 4u IPv4 540438 0t0 TCP *:http-alt (LISTEN)

ps 打印出来的相关进程

root 39329 0.0 0.8 712656 8408 ? Sl 02:13 0:04 /usr/bin/containerd-shim-runc-v2 -namespace moby -id fb3e322b046393bd2e5a273b48e2bedb4ac3eff1ea0f8024ec73e06afb6325fc -address /run/containerd/containerd.sock
root 39351 0.0 1.7 26224 17728 ? Ss 02:13 0:11 \_ /usr/local/bin/python /usr/local/bin/gunicorn app.server:app
root 39401 0.0 11.6 319688 117612 ? Sl 02:13 0:05 \_ /usr/local/bin/python /usr/local/bin/gunicorn app.server:app
jackyzy823
2023-04-05 12:19:02 +08:00
@ningyu

根据 slack 的文档 https://api.slack.com/apis/connections/events-api "Your URL didn't respond"之后会跟上具体的错误。能否提供这个错误信息。
ericbize
2023-04-05 12:22:44 +08:00
翻一下 log ?
ningyu
2023-04-05 13:18:28 +08:00
@jackyzy823
我在仓库的 repo 上面补充了 slack 上面的提示信息,之前没注意到,除了“Your URL didn't respond”之外,还有一个错误提示“The server couldn’t be reached at your request URL”。
截图:
https://user-images.githubusercontent.com/1762074/229986482-4227abab-4a4c-475a-8e00-820de3f85e15.png

但是我把端口换成 1989 ,这个是我在 vps 上启动的 gost 服务的端口,这时提示就是“Your URL didn't respond with the value of the challenge parameter”,同时,上面的提示信息是“Your request URL responded with an HTTP error. Update your URL to receive a new request and challenge value.”。
截图:
https://user-images.githubusercontent.com/1762074/229986592-36bed70a-f5cb-4afd-a8ed-43ba43c39d21.png

看这个现象,意思就是 1989 能访问到,但是 8080 访问不到,这里是不是只能翻代码了。。。
ningyu
2023-04-05 13:19:54 +08:00
@ericbize log 在哪里呢。。我刚才又试了下,还有另外一个提示“The server couldn’t be reached at your request URL”,但是换成 1989 就是另外的提示,感觉应该就是端口不通
jackyzy823
2023-04-05 13:42:12 +08:00
@ningyu 日志 docker-compose logs

感觉是请求超时导致的。
akinoniku
2023-04-05 13:47:03 +08:00
先试试 socket mode ?
ningyu
2023-04-05 14:14:23 +08:00
@jackyzy823

docker-compose logs 打印的日志有点多,但是看起来都不是我的日志,可能是别人在群里使用 slack 时的信息。什么情况下会导致超时呢,而且我用 1989 端口时是有返回的,只是返回的不是 slack 预期的信息,毕竟这个端口对应的服务不是 slack 的 app

mygptreader_config-web-1 | INFO:root:请用中文简短概括这篇文章的内容。
mygptreader_config-web-1 | INFO:root:=====> text_qa_template
mygptreader_config-web-1 | INFO:root:<llama_index.prompts.prompts.QuestionAnswerPrompt object at 0x7f879bd6b6a0>
mygptreader_config-web-1 | INFO:root:> [query] Total LLM token usage: 202 tokens
mygptreader_config-web-1 | INFO:root:> [query] Total embedding token usage: 34 tokens
mygptreader_config-web-1 | INFO:root:=====> GPT response: 这篇文章的内容是:出现了 401 错误,表示未经授权无法访问。 (total_llm_model_tokens: 202, total_embedding_model_tokens: 34
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | ERROR:root:The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
mygptreader_config-web-1 | The server responded with: {'ok': False, 'error': 'channel_not_found'}
mygptreader_config-web-1 | INFO:apscheduler.executors.default:Job "schedule_news (trigger: cron[hour='1', minute='30'], next run at: 2023-04-06 01:30:00 UTC)" executed successfully
mygptreader_config-web-1 | INFO:slack_bolt.RequestVerification:Invalid request signature detected (signature: , timestamp: 0, body: {"text":"Hello, world!"})

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/929924

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX