hasura / hasura/graphql-engine
Apparent problem using the command line to migrate metadata after a table rename on linux
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: Cloud
CLI Version (for CLI related issue): v2.0.9
### Environment
Cloud
### What is the expected behaviour?
Using the CLI with the same git repo containing migration and metadata behaves the same way on linux and macOS. Also, metadata and migrations created using `Hasura console` pointed to an environment should be able to be applied via the same cli command on both OSes with the same results.
### Keywords
CLI, Linux, Table renames
### What is the current behaviour?
A metadata update fails on linux but succeeds on macOS. This appears to have started after renaming a table.
### How to reproduce the issue?
1. Create some metadata changes.
2. Rename a table (This appears to be the only interesting change when this started failing)
3. Run `hasura metadata apply` against the cloud instance via macOS
4. Run `hasura metadata apply` against the cloud instance via Debian linux.
### Screenshots or Screencast
### Please provide any traces or logs that could help here.
When I perform a ` hasura metadata apply --project . --log-level debug` on macOS, it works.
```
DEBU global config file exists, verifying contents
DEBU global config is pre-set to &cli.GlobalConfig{UUID:"", EnableTelemetry:true, ShowUpdateNotification:true, CLIEnvironment:"default"}
DEBU global config: uuid:
DEBU global config: enableTelemetry: true
DEBU global config: showUpdateNotification: true
DEBU global config: cliEnvironment: default
DEBU ENV vars read from: /Users/jasonmusgrave/git/cabana/cabana-hasura/.env
DEBU cannot get config information from server, this might be because config API is not enabled: json: cannot unmarshal object into Go struct field HasuraServerInternalConfig.jwt of type string
DEBU graphql engine endpoint: https://cabana-dev.hasura.app
DEBU graphql engine admin_secret:
DEBU versions: cli: [v2.0.9] server: [v2.0.8-cloud.3]
DEBU compatibility check: [true] compatible CLI and Server
DEBU server: uuid:
DEBU building metadata: functions node not found for default
DEBU cli-ext: setting up using cli-ext embedded in cli binary
DEBU output: {"success":true,"output_file_path":"/var/folders/5p/pln30rrd5vb71b3kcqk5ffnh0000gn/T/580015252.json"} command="sdl from"
DEBU metadata file for inherited_roles was not found, assuming an empty file
DEBU metadata file for api_limits was not found, assuming an empty file
DEBU metadata file for graphql_schema_introspection was not found, assuming an empty file
DEBU metadata file for query_tags was not found, assuming an empty file
DEBU metadata applied using v2 replace_metadata
INFO Metadata applied
DEBU telemetry: beamed fields.time=552.564822ms isError=false
```
When Executed on my CI server in a Debian docker container:
```
{"level":"debug","msg":"global config file exists, verifying contents","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"global config is pre-set to \u0026cli.GlobalConfig{UUID:\"\", EnableTelemetry:true, ShowUpdateNotification:true, CLIEnvironment:\"default\"}","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"global config: uuid: ","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"global config: enableTelemetry: true","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"global config: showUpdateNotification: true","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"global config: cliEnvironment: default","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"cannot get config information from server, this might be because config API is not enabled: json: cannot unmarshal object into Go struct field HasuraServerInternalConfig.jwt of type string","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"graphql engine endpoint: https://cabana-dev.hasura.app","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"graphql engine admin_secret: [MASKED]","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"versions: cli: [v2.0.9] server: [v2.0.8-cloud.3]","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"compatibility check: [true] compatible CLI and Server","time":"2021-09-23T00:30:24Z"}
{"level":"debug","msg":"server: uuid: ","time":"2021-09-23T00:30:25Z"}
{"level":"info","msg":"Applying metadata...","time":"2021-09-23T00:30:25Z"}
{"level":"debug","msg":"metadata file for sources was not found, assuming an empty file","time":"2021-09-23T00:30:25Z"}
{"level":"debug","msg":"cli-ext: setting up using cli-ext embedded in cli binary","time":"2021-09-23T00:30:25Z"}
{"command":"sdl from","level":"debug","msg":"output: {\"success\":true,\"output_file_path\":\"/tmp/533135918.json\"}\n","time":"2021-09-23T00:30:25Z"}
{"level":"debug","msg":"metadata file for inherited_roles was not found, assuming an empty file","time":"2021-09-23T00:30:25Z"}
{"level":"debug","msg":"metadata file for api_limits was not found, assuming an empty file","time":"2021-09-23T00:30:25Z"}
{"level":"debug","msg":"metadata file for graphql_schema_introspection was not found, assuming an empty file","time":"2021-09-23T00:30:25Z"}
{"level":"debug","msg":"metadata file for query_tags was not found, assuming an empty file","time":"2021-09-23T00:30:25Z"}
{"fields.time":"375.453857ms","isError":true,"level":"debug","msg":"telemetry: beamed","time":"2021-09-23T00:30:26Z"}
time="2021-09-23T00:30:26Z" level=fatal msg="error applying metadata \n{\n \"path\": \"$.args.metadata\",\n \"error\": \"key \\\"sources\\\" not found\",\n \"code\": \"parse-failed\"\n}"
```
### Any possible solutions?
Unknown.
### Can you identify the location in the source code where the problem exists?
No.
### If the bug is confirmed, would you be willing to submit a PR?
If it was within my skillset and I have the time I would consider it.
Contributor guide
Assessment
This issue has not been assessed yet.