nhost / hasura-backend-plus

🔑Auth and 📦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.
https://nhost.github.io/hasura-backend-plus/
MIT License
1.17k stars 187 forks source link

Error on startup of HBP #277

Closed Svarto closed 4 years ago

Svarto commented 4 years ago

Hi,

I tried to install a fresh HBP instance with the docker-compose provided. Getting the following error when the HBP container tries to startup:


hasura-backend-plus_1  | yarn run v1.22.4
hasura-backend-plus_1  | $ node -r ./prod-paths.js ./dist/start.js
hasura-backend-plus_1  | internal/modules/cjs/loader.js:1032
hasura-backend-plus_1  |   throw err;
hasura-backend-plus_1  |   ^
hasura-backend-plus_1  | 
hasura-backend-plus_1  | Error: Cannot find module '/app/dist/start.js'
hasura-backend-plus_1  |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
hasura-backend-plus_1  |     at Function.Module._resolveFilename (/app/node_modules/tsconfig-paths/lib/register.js:75:40)
hasura-backend-plus_1  |     at Function.Module._load (internal/modules/cjs/loader.js:898:27)
hasura-backend-plus_1  |     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
hasura-backend-plus_1  |     at internal/main/run_main_module.js:17:47 {
hasura-backend-plus_1  |   code: 'MODULE_NOT_FOUND',
hasura-backend-plus_1  |   requireStack: []
hasura-backend-plus_1  | }
hasura-backend-plus_1  | error Command failed with exit code 1.
hasura-backend-plus_1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The graphql engine then keeps trying to connect but can't as the HBP container has not started.

My docker-compose:


version: '3.6'
services:
  postgres:
    image: postgres:12
    restart: always
    environment:
      POSTGRES_PASSWORD: postgrespassword321
    networks:
      - hasura-network
    volumes:
      - db_data:/var/lib/postgresql/data
  graphql-engine:
    image: hasura/graphql-engine:v1.2.1
    ports:
      - '8090:8080'
    depends_on:
      - 'postgres'
    restart: always
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword321@postgres:5432/postgres
      HASURA_GRAPHQL_ADMIN_SECRET: '$HASURA_GRAPHQL_ADMIN_SECRET'
      HASURA_GRAPHQL_JWT_SECRET: '{"type": "RS256", "jwk_url": "http://hasura-backend-plus:3000/auth/jwks"}'
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
    networks:
      - traefik-network
      - hasura-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.hasura.entrypoints=https"
      - "traefik.http.routers.hasura.rule=Host(`hasura.$DOMAINNAME`)"
      - "traefik.http.routers.hasura.tls.certresolver=dns-digitalocean"
      - "traefik.http.routers.hasura.service=hasura"
      - "traefik.http.services.hasura.loadbalancer.server.port=8080"

  hasura-backend-plus:
    image: nhost/hasura-backend-plus:latest
    ports:
      - '3000:3000'
    environment:
      PORT: "3000"
      HOST: "0.0.0.0"
      SERVER_URL: http://localhost:3000
      HASURA_ENDPOINT: http://graphql-engine:8080/v1/graphql
      HASURA_GRAPHQL_ADMIN_SECRET: '$HASURA_GRAPHQL_ADMIN_SECRET'
      JWT_ALGORITHM: RS256
      S3_ENDPOINT: http://minio:9000
      S3_BUCKET: hasura-backend-plus
      S3_ACCESS_KEY_ID: minio_access_key
      S3_SECRET_ACCESS_KEY: '${S3_SECRET_ACCESS_KEY:?S3_SECRET_ACCESS_KEY}'
      AUTO_MIGRATE: "true"
    networks:
      - traefik-network
      - hasura-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.minio.entrypoints=https"
      - "traefik.http.routers.minio.rule=Host(`minio.$DOMAINNAME`)"
      - "traefik.http.routers.minio.tls.certresolver=dns-digitalocean"
      - "traefik.http.routers.minio.service=hasura"
      - "traefik.http.services.minio.loadbalancer.server.port=3000"

  minio:
    image: minio/minio
    restart: always
    networks:
      - hasura-network
    environment:
      S3_BUCKET: hasura-backend-plus
      MINIO_ACCESS_KEY: minio_access_key
      MINIO_SECRET_KEY: '${S3_SECRET_ACCESS_KEY:?S3_SECRET_ACCESS_KEY}'
    entrypoint: sh
    command: "-c 'mkdir -p /export/hasura-backend-plus && /usr/bin/minio server /export'"
    volumes:
      - 'minio_data:/data'
volumes:
  db_data:
    driver: local-persist
    driver_opts:
      mountpoint: "${DOCKER_VOLUMES}/hasura"
  minio_data:
    driver: local-persist
    driver_opts:
      mountpoint: "${DOCKER_VOLUMES}/minio"

networks:
  traefik-network:
    external: true
  hasura-network:

Anyone has an idea what is going on?

elitan commented 4 years ago

I suspect that you are using an old version of HBP.

Solution #1 (best)

Specify exactly the HBP version to use like this: image: nhost/hasura-backend-plus:v2.0.0

Solution #2

Pull down the latest image of hbp: docker-compose pull.

Svarto commented 4 years ago

Thank you! Solution 1 worked great.