gpt4 book ai didi

docker - Hasura 操作处理程序不存在(名称或服务未知)

转载 作者:行者123 更新时间:2023-12-04 18:29:27 34 4
gpt4 key购买 nike

我有一个在 Docker 容器中运行的 Hasura 实例和直接在机器上运行的用 NodeJS/Express 编写的 Action 处理程序 API。
当我在本地测试所有内容时,它就像一个魅力(macOS M1),但是当我在服务器(Ubuntu 20.04)上复制相同的设置时,它返回一个 Action 处理程序不存在错误。
所有其他查询和突变都运行良好,只是操作返回此错误
您可以看到 Hasura 和 NodeJS 应用程序都在运行
hasura docker container
localhost api call
在本地开发中,我的 Action 处理程序基本 url 是

http://host.docker.internal:5000/api


它工作正常。
我也试过

http://localhost:5000/api


http://127.0.0.1:5000/api


这是 Hasura 操作调用返回的确切错误
{
"errors": [
{
"extensions": {
"internal": {
"error": {
"type": "http_exception",
"message": "ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = 0.0.0.0:0, addrCanonName = Nothing}, host name: Just \"host.docker.internal\", service name: Just \"5000\"): does not exist (Name or service not known)"
},
"response": null,
"request": {
"body": {
"session_variables": {
"x-hasura-role": "public"
},
"input": {
"email": "",
"password": ""
},
"action": {
"name": "login"
}
},
"url": "http://host.docker.internal:5000/api/auth/login",
"headers": []
}
},
"path": "$",
"code": "unexpected"
},
"message": "http exception when calling webhook"
}
]
}

最佳答案

如果有人遇到同样的问题,我就是这样解决的
将此添加到 docker-compose.yml 文件

    extra_hosts:
- "host.docker.internal:host-gateway"
允许端口 8080 5000 防火墙
 sudo ufw allow 8080 
sudo ufw allow 5000

关于docker - Hasura 操作处理程序不存在(名称或服务未知),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70127313/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com