React Native 如何设置Hasura CLI?

gudnpqoy  于 2022-11-17  发布在  React
关注(0)|答案(2)|浏览(134)

我安装了hasura CLI,我想发送我的hasura云项目上的数据。我尝试了不同的方法来启动hasura控制台,但我没有找到启动它的好方法。每次我都有同样的错误,我不知道如何解决它。
您可以在我的项目中看到我的Hasura CLI配置文件和错误。

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 "http://localhost:8080/healthz": dial tcp [::1]:8080: connect: connection refused

谢谢

oewdyzsn

oewdyzsn1#

已解决:
当我们使用apollo客户端时,我们需要在客户端中这样设置头:

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

这解决了我问题

au9on6nz

au9on6nz2#

我有两个版本的hasura-cli,一个安装了curl,一个安装了npm。
我通过删除所有版本并使用npm安装hasura-cli并重新启动系统来解决此问题

相关问题