Logo-amall

Hey everyone! I am using Nhost serverless functions to connect to the Hasura Events. I have an event set up for a specific function but when I trigger the function from the hasura console (or by an INSERT, UPDATE, or DELETE operation) I get this as the response... ```{ "data": { "message": "{\"type\":\"http_exception\",\"message\":\"Connection failure\",\"request\":{\"secure\":false,\"path\":\"/v1/functions/workspace-event-insert-workspace-log\",\"responseTimeout\":\"ResponseTimeoutMicro 60000000\",\"queryString\":\"\",\"method\":\"POST\",\"requestHeaders\":{\"Content-Type\":\"application/json\",\"X-B3-ParentSpanId\":\"aa2c937007b3b668\",\"X-B3-TraceId\":\"b9b1698b8f23b8e2\",\"X-B3-SpanId\":\"6b2baa2b62719f2e\",\"User-Agent\":\"hasura-graphql-engine/v2.8.1\",\"nhost-webhook-secret\":\"nhost-webhook-secret\"},\"host\":\"localhost\",\"port\":1337}}" }, "version": "2", "type": "client_error" } ``` As you can see I am doing this with the CLI on my local machine. I would say that I have the url wrong or the serverless function wrong but when I enter the url into a browser I get the response "OK" so I know it is hitting the serverless function and it returns OK. Any ideas why Hasura can't seem to connect to my serverless function?

Last active 7 months ago

6 replies

6 views

  • AL

    Hey everyone! I am using Nhost serverless functions to connect to the Hasura Events. I have an event set up for a specific function but when I trigger the function from the hasura console (or by an INSERT, UPDATE, or DELETE operation) I get this as the response…

      "data": {
        "message": "{\"type\":\"http_exception\",\"message\":\"Connection failure\",\"request\":{\"secure\":false,\"path\":\"/v1/functions/workspace-event-insert-workspace-log\",\"responseTimeout\":\"ResponseTimeoutMicro 60000000\",\"queryString\":\"\",\"method\":\"POST\",\"requestHeaders\":{\"Content-Type\":\"application/json\",\"X-B3-ParentSpanId\":\"aa2c937007b3b668\",\"X-B3-TraceId\":\"b9b1698b8f23b8e2\",\"X-B3-SpanId\":\"6b2baa2b62719f2e\",\"User-Agent\":\"hasura-graphql-engine/v2.8.1\",\"nhost-webhook-secret\":\"nhost-webhook-secret\"},\"host\":\"localhost\",\"port\":1337}}"
      },
      "version": "2",
      "type": "client_error"
    }
    

    As you can see I am doing this with the CLI on my local machine. I would say that I have the url wrong or the serverless function wrong but when I enter the url into a browser I get the response "OK" so I know it is hitting the serverless function and it returns OK. Any ideas why Hasura can't seem to connect to my serverless function?

  • EL

    Hmm, looks good. What OS are you on? I suspect this is a local issue due to the fact that the current CLI runs Hasura in a Docker container and serverless functions on the host machine. It will be different in our updated CLI where everything will be running inside docker containers in the same docker network.

  • AL

    I am runnung Ubuntu 20.04

  • AL

    Just as a bit of information. I was able to get the request to hit the serverless function if I used the IP address of my machine rather than localhost. This would probably be a helpful thing to have in the nhost docs until the updated CLI has everything inside of docker containers.

  • EL

    Yea this is 99% an issue with Ubuntu and the fact that I mentioned above. Will be fixed with this PR:: https://github.com/nhost/cli/pull/257

  • EL

    eta 1-2 weeks max. Hopefully much sooner.

Last active 7 months ago

6 replies

6 views