hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.18k stars 2.77k forks source link

Hasura console is not able to reach your Hasura GraphQL engine instance. Please ensure that your instance is running and the endpoint is configured correctly. #5905

Open tavakoli-ali opened 4 years ago

tavakoli-ali commented 4 years ago

I hade up and run docker image but last week, all of the sudden, it had been down. I got this error for 1 week and try all things and didn't work, I removed the docker file and image, container and install fresh but also didn't work, and got this message: DB schema loading failed Failed to fetch. docker :

`version: '3.7' services: postgres: image: postgres:12 restart: always volumes:

Originally posted by @tavakoli-ali in https://github.com/hasura/graphql-engine/issues/2378#issuecomment-703175933

rolivegab commented 4 years ago

Hi! I've a configuration that works for me:

version: '3.7'
services:
  hasura:
    image: docker.io/hasura/graphql-engine:v1.3.2
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
      HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_GRAPHQL_ADMIN_SECRET}
    ports:
      - 8080:8080

  postgres:
    image: docker.io/postgres:alpine
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}

maybe its because, accordingly to postgres image docker hub docs (https://hub.docker.com/_/postgres), database variable name must be POSTGRES_DB.

tirumaraiselvan commented 4 years ago

Can you post the container logs please?

sdil commented 4 years ago

I have the same problem. This is my docker-compose.yml file:

version: '3.6'
services:
  postgres:
    image: postgres:12
    restart: always
    volumes:
    - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: xxx
  graphql-engine:
    image: hasura/graphql-engine:v1.3.2
    ports:
    - "8080:8080"
    depends_on:
    - "postgres"
    - "hasura-firebase-auth-webhook"
    restart: always
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:xxx@postgres:5432/postgres
      ## enable the console served by server
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
      ## enable debugging mode. It is recommended to disable this in production
      HASURA_GRAPHQL_DEV_MODE: "true"
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
      HASURA_GRAPHQL_CORS_DOMAIN: "http://localhost:3000, http://localhost:8080"
      ## Set a secure admin secret
      HASURA_GRAPHQL_ADMIN_SECRET: xxx
      HASURA_GRAPHQL_AUTH_HOOK: http://hasura-firebase-auth-webhook:8081/auth

I am able to see the console at localhost:8080/console/login

But when I run hasura console --endpoint http://localhost:8080 --admin-secret xxx, it opens localhost:9695 and show the following error

image

Any idea why it happened and how to fix this?

EugeneHerasymchuk commented 3 years ago

what about OS that you're using? I have same issue after upgrading from Catalina to Big Sur with docker images: postgres:12 hasura/graphql-engine:v1.3.4-beta.3

rikinsk commented 3 years ago

@sdil This could be due to your CORS settings. I see you have localhost:3000 and localhost:8080 enabled but not localhost:9695 which is where the CLI console runs

edit: realising its been a while since you had asked. hope you had managed to resolve this

EugeneHerasymchuk commented 3 years ago

or cleaning cache? sorry, for stupid suggestion, but console cache could have an old config and it might be a solution