nhost / hasura-auth

Authentication for Hasura.
https://nhost.io
MIT License
385 stars 114 forks source link

Metadata failed to apply in latest hasura v2 version #540

Open edouardouvrard opened 4 months ago

edouardouvrard commented 4 months ago

Metadata failed to apply without explicit error

dbarrosop commented 4 months ago

Hi, thanks for the report. However, I can not reproduce, please, provide instructions on how to reproduce the issue.

Thanks

Tchoupinax commented 2 months ago

Hello,

Here is the exemple to reproduce the issue

services:
  postgres:
    image: postgres:16
    restart: unless-stopped
    ports:
      - "5432:5432"
    volumes:
      - foo-dev-postgres:/var/lib/postgresql/data
    networks:
      - foo2
    environment:
      POSTGRES_PASSWORD: mysecret

  hasura:
    image: hasura/graphql-engine:v2.42.0
    restart: unless-stopped
    ports:
      - "8080:8080"
    networks:
      - foo2
    depends_on:
      - "postgres"
    environment:
      HASURA_GRAPHQL_ADMIN_INTERNAL_ERRORS: true
      HASURA_GRAPHQL_ADMIN_SECRET: secret
      HASURA_GRAPHQL_CORS_DOMAIN: "*"
      HASURA_GRAPHQL_DEV_MODE: true
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
      HASURA_GRAPHQL_ENABLE_CONSOLE: true
      HASURA_GRAPHQL_ENABLE_TELEMETRY: false
      HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:mysecret@postgres:5432/postgres
      PG_DATABASE_URL: postgres://postgres:mysecret@postgres:5432/postgres
      HASURA_GRAPHQL_JWT_SECRET: >-
        {"type":"HS256", "key":
        "secret"}

  hasura-auth:
    image: "nhost/hasura-auth:0.33.0-beta3"
    restart: always
    depends_on:
      - hasura
    ports:
      - "4001:4000"
    networks:
      - foo2
    environment:
      HASURA_GRAPHQL_JWT_SECRET: >-
        {"type":"HS256", "key":
        "secret"}
      HASURA_GRAPHQL_DATABASE_URL: "postgres://postgres:mysecret@postgres:5432/postgres"
      HASURA_GRAPHQL_GRAPHQL_URL: "http://hasura:8080/v1/graphql"
      HASURA_GRAPHQL_ADMIN_SECRET: "secret"

  minio:
    image: "minio/minio:RELEASE.2024-08-17T01-24-54Z"
    user: "999:1001"
    restart: always
    environment:
      MINIO_ACCESS_KEY: 5a7bdb5f42c41e0622bf61d6e08d5537
      MINIO_SECRET_KEY: 9e1c40c65a615a5b52f52aeeaf549944ec53acb1dff4a0bf01fb58e969f915c8
    entrypoint: sh
    command: -c 'mkdir -p /data/nhost && /usr/bin/minio server /data'
    ports:
      - "9000:9000"
    volumes:
      - "foo-dev-minio:/data"

networks:
  foo2:
volumes:
  foo-dev-postgres:
  foo-dev-minio:

Logs

{"level":"info","message":"Log level: info"}
{"level":"info","message":"Waiting for Hasura to be ready..."}
{"level":"info","message":"Hasura is ready"}
{"level":"info","message":"Applying SQL migrations..."}
{"level":"info","message":"SQL migrations applied"}
{"level":"info","message":"Applying metadata..."}
{"level":"warn","message":"Impossible to apply metadata"}
/nix/store/9w8fnyck8l3rbmkn53sn4cxahjnqlpvn-node_modules-prod/node_modules/.pnpm/graphql-request@3.7.0_graphql@16.2.0/node_modules/graphql-request/dist/index.js:340
                        throw new types_1.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables });
                              ^

ClientError: field 'insertAuthRoles' not found in type: 'mutation_root': {"response":{"errors":[{"message":"field 'insertAuthRoles' not found in type: 'mutation_root'","extensions":{"path":"$.selectionSet.insertAuthRoles","code":"validation-failed"}}],"status":200,"headers":{}},"request":{"query":"mutation upsertRoles($roles: [authRoles_insert_input!]!) {\n  insertAuthRoles(\n    objects: $roles\n    on_conflict: {constraint: roles_pkey, update_columns: []}\n  ) {\n    affected_rows\n    returning {\n      role\n    }\n  }\n}","variables":{"roles":[{"role":"me"},{"role":"user"}]}}}
dbarrosop commented 2 months ago

This looks like a misconfiguration in your environment. My bet is that your metadata has conflicts.

Tchoupinax commented 2 months ago

Error: Source default not found

Indeed, my source is not called default