question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Metadata import fails with parsing error

See original GitHub issue

I’m trying to track a particular table, export the metadata, then have it apply automatically on startup of the cli image. Below is my docker-compose file and sql startup script, as well as the metadata file. I get the following error:

hasura_1    | {"timestamp":"2020-10-08T09:33:28.000+0000","level":"info","type":"startup","detail":{"kind":"migrations-apply","info":"applying metadata from /hasura-metadata"}}
...
hasura_1    | time="2020-10-08T09:33:30Z" level=fatal msg="failed to apply metadata: cannot apply metadata on the database: [parse-failed] key \"tables\" not found ($[1])"

docker-compose.yml

version: '3.7'

services:
  postgres:
    image: postgres:9.6
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=test
    ports:
      - 5432:5432
    volumes:
      - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
  hasura:
#    image: hasura/graphql-engine:v1.3.2
    image: hasura/graphql-engine:v1.3.2.cli-migrations-v2
    volumes:
      - ./hasura_server/metadata:/hasura-metadata
    ports:
      - "8000:8080"
    depends_on:
      - postgres
    restart: always
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgresql://postgres:postgres@postgres:5432/test
      ## 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
      ## uncomment next line to set an admin secret
      HASURA_GRAPHQL_ADMIN_SECRET: letmein

init.sql

create table sometable(id int);

metadata.json

{
  "version": 2,
  "tables": [
    {
      "table": {
        "schema": "public",
        "name": "sometable"
      }
    }
  ]
}

folder structure image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
dewaldabriecommented, Oct 16, 2020

@scriptonist Thanks that helped a lot. I managed with the following steps:

  1. installation of local hasura cli
  2. run docker-compose with either cli or non-cli image
  3. configure data settings (which tables to track)
  4. on local side, run hasura init my-project --endpoint http://localhost:<hasura_port>
  5. on local side, ruin cd my-project; hasura metadata export
  6. make sure the local metadata dir is mapped to /hasura-metadata on the hasura cli image
  7. bring docker-compose up and down and will and state of metadata persists
2reactions
scriptonistcommented, Oct 13, 2020

Hey @dewaldabrie, I think it’s because we don’t have the directory structure which is expected by the CLI. What you can probably do is use the CLI to create a hasura project.

Assuming you are in hasura_server directory use the following command to initialize the project.

hasura init .

This should populate a couple of directories, of which one will be metadata directory. Then you can export the metadata from the server using the following command.

hasura metadata export

This should export metadata to metadata directory. Now things should work without a problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing Errors while importing Metadata for SAML, Error
Symptoms. When attempting to import metadata for a SAML Credential Mapping provider, the following error occurs: Cause. Sign In ...
Read more >
Certificate import error - Failed to parse IDP Metadata
Consult the IDP documentation on how to export the file. On the Firewall, go to the GUI: Device > Server Profiles > SAML...
Read more >
Failed to parse project metadata and info… - Apple Community
Failed to parse project metadata and information. ... The import process ends up with the above error message but I noticed all my...
Read more >
A "Loading MSXML parser failed" Error Occurs When ...
1 Loading MSXML parser failed. Cause. When importing a briefcase or volume, Laserfiche parses XML files that contain the relevant metadata ...
Read more >
JR49289: JDBC CONNECTOR METADATA IMPORT FAILS ...
Metadata import in IBM InfoSphere Metadata Asset Manager using JDBC Connector fails due to the invalid "catalog" attribute. This error can happen when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found