这是indexloc提供的服务,不要输入任何密码
Skip to content

Spaces in database name cause failure to start #6852

@cfergus

Description

@cfergus

Short version : if the database name entered in the console has a space in it, the next startup of hasura will fail.

My environment:

  • Ubuntu 20.04
  • hasura/graphql-engine:v2.0.0-alpha.10.cli-migrations-v3

What I did:

  • Copied docker compose file (included at the bottom) and disabled console
  • Run hasura init ./hasura
  • docker-compose up
  • cd hasura
  • hasura console
  • Open browser to localhost:9695
  • Go to 'Data > Connect Database'
  • For Database Display Name, enter My Database Name
  • ENV VAR for connection = HASURA_GRAPHQL_DATABASE_URL
  • Create table "temptable" with "name" column and automatic Primary key ID.
  • Ctrl+C to terminate docker compose
  • docker-compose up

At this point it cannot start, with the error message:

graphql-engine_1 | time="2021-04-29T20:55:03Z" level=fatal msg="failed to apply metadata: \n{\n "path": "$.metadata.sources[0].tables",\n "error": "parsing [] failed, expected Array, but encountered String",\n "code": "parse-failed"\n}"

The spaces appear to be causing the problem. For example, in metadata/databases/databases.yaml: "!include My Database Name/tables/tables.yaml"

My docker-compose file:

version: '3.6'
services:
  postgres:
    image: postgres:12
    restart: always
    volumes:
    - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: postgrespassword

  graphql-engine:
    image: hasura/graphql-engine:v2.0.0-alpha.10.cli-migrations-v3
    ports:
    - "8080:8080"
    depends_on:
    - "postgres"
    restart: always
    volumes: 
     - ./hasura/migrations:/hasura-migrations
     - ./hasura/metadata:/hasura-metadata
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: "false" # set to "false" to disable console
      HASURA_GRAPHQL_DEV_MODE: "true"
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log

volumes:
  db_data:

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions