'http exception when calling webhook' on localhost
Discussed in https://github.com/hasura/graphql-engine/discussions/8979
Originally posted by kdichev September 18, 2022
Hi, I am developing locally with hasura running with docker-composed container on port 8080, I have a functions api on port 8000. I've setup my action with env variable as so {{ACTION_BASE_URL}}/subscriptions-config and the value of the variable is http://host.docker.internal:8000/api. When I call the action I get 'http exception when calling webhook', but I am using the same approach for hasura events that calls the same functions api which work as expected. Shouldn't this just work for actions as well? Seems like a bug. I am on a mac machine. I've seen a few similar issues here but seems like it's hacks rather than real solutions (I would expect actions to work as events work with this workflow)
{
"errors": [
{
"extensions": {
"code": "unexpected",
"internal": {
"error": {
"message": "Connection failure",
"request": {
"host": "host.docker.internal",
"method": "POST",
"path": "/api/subscriptions-config",
"port": 8000,
"queryString": "",
"requestHeaders": {
"Content-Type": "application/json",
"User-Agent": "hasura-graphql-engine/v2.11.1",
"X-B3-ParentSpanId": "c7bed813e6d658f6",
"X-B3-SpanId": "b9ecef585bda4388",
"X-B3-TraceId": "57a3623d4c669c18"
},
"responseTimeout": "ResponseTimeoutMicro 30000000",
"secure": false
},
"type": "http_exception"
},
"request": {
"body": {
"action": {
"name": "stripe_price"
},
"input": {
"currency": "bgn"
},
"request_query": "query MyQuery {\n stripe_price(currency: \"bgn\") {\n id\n unit_amount\n }\n}\n",
"session_variables": {
"x-hasura-role": "admin"
}
},
"headers": [],
"transformed_request": null,
"url": "{{ACTION_BASE_URL}}/subscriptions-config"
},
"response": null
},
"path": "$"
},
"message": "http exception when calling webhook"
}
]
}
```</div>
@kdichev Looks like you are running the Action with "admin" user role. Hope, you have defined "Action_Secret" to go with it and configured it properly. Here is the Hasura Doc for reference:
https://hasura.io/docs/latest/actions/action-handlers/#add-a-header-to-your-action
facing same error, hasura 2.20.9
First of all, you should ensure the connection between hasura and your API server via host.docker.internal gateway. The connection must be checked to use directly. (Of course, you may connect the network well.)
Secondly, based on my knowledge, hasura does not support a promised-word, such as localhost. Thus, host.docker.internal may not be available with this case.
I recommend that you should use exact IP (like http://192.168.64.1) to check your connections. Then, if the promised-word (that can be used to replace the IP) would not be worked, it means hasura does not support it.