How to setup Hasura CLI?

How to setup Hasura CLI?


0

I installed hasura CLI and I want to send data on my hasura cloud project. I tried different ways to launch hasura console but I don’t find the good way to launch it. Every time I have the same error and I don’t know how to solve it.

You can see my Hasura CLI config file in my project and the error.

INFO possible reasons:
INFO 1) Provided root endpoint of graphql-engine server is wrong. Verify endpoint key in config.yaml or/and value of --endpoint flag
INFO 2) Endpoint should NOT be your GraphQL API, ie endpoint is NOT https://hasura-cloud-app.io/v1/graphql it should be: https://hasura-cloud-app.io
INFO 3) Server might be unhealthy and is not running/accepting API requests
INFO 4) Admin secret is not correct/set
INFO
FATA[0002] making http request failed: Get "https://localhost:8080/healthz": dial tcp [::1]:8080: connect: connection refused

How to setup Hasura CLI?

How to setup Hasura CLI?

Thanks

2

  • Are you sure the Hasura server is running at localhost:8080? Since you mentioned you wanted to use Hasura Cloud project, can you pass the project URL as the endpoint. For example: hasura console --endpoint https://myapp.hasura.app --admin-secret xxxx and try it out.

    – praveenweb

    Feb 2, 2022 at 8:31

  • yes i try this solution from my terminal and in the file config.yaml but still the same error. When I launch the project, I have this error : x-hasura-admin-secret/x-hasura-access-key required, but not found But my key is in my file

    – Matthys Ducrocq

    Feb 2, 2022 at 10:12


3 Answers
3


0

resolved :

When we use apollo client, we need to set the header in the client like this :


const client = new ApolloClient({
  uri: "https://yourapp.hasura.app/v1/graphql",
  cache: new InMemoryCache(),
  headers: {
    "content-type": "application/json",
    "x-hasura-admin-secret":
      "",
  },
});

this fix my problem

1

  • That does not answer the question at all. You figured out how to use apollo but you did not figure out how to start the console.

    – Friedrich

    Apr 19, 2022 at 12:04


0

I Had two versions of hasura-cli, one installed with curl and one installed with npm.

I resolve the problem by removing all the version and installing the hasura-cli with npm and restarting the system

1

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

    – Community
    Bot

    Nov 14, 2022 at 11:36


0

I am having the same issue. I am using wsl 2 and I get the same error when I try to run Hasura. Docker containers seem to be working fine.
This is the error I get:

ERRO connecting to graphql-engine server failed
INFO possible reasons:
INFO 1) Provided root endpoint of graphql-engine server is wrong. Verify endpoint key in config.yaml or/and value of –endpoint flag
INFO 2) Endpoint should NOT be your GraphQL API, ie endpoint is NOT https://hasura-cloud-app.io/v1/graphql it should be: https://hasura-cloud-app.io
INFO 3) Server might be unhealthy and is not running/accepting API requests
INFO 4) Admin secret is not correct/set
INFO

Any update on this? Did you manage to figure it out?
Thanks!



Leave a Reply

Your email address will not be published. Required fields are marked *