Metadata import fails with parsing error
See original GitHub issueI’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

Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@scriptonist Thanks that helped a lot. I managed with the following steps:
hasura init my-project --endpoint http://localhost:<hasura_port>cd my-project; hasura metadata export/hasura-metadataon the hasura cli imageHey @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_serverdirectory use the following command to initialize the project.This should populate a couple of directories, of which one will be
metadatadirectory. Then you can export the metadata from the server using the following command.This should export metadata to
metadatadirectory. Now things should work without a problem.