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

yaml parsing errors in CLI tool metadata export #9862

@alecf

Description

@alecf

Version Information

Server Version: 2.32.1
CLI Version (for CLI related issue): 2.32.1

Environment

Cloud

What is the current behaviour?

Starting with version 2.32.1, I can no longer export metadata, I get an error parsing:

FATA[0000] failed to export metadata: cannot export sources from metadata: error parsing metadata 
object: sources
file: databases.yaml
error: yaml: unmarshal errors:
  line 1: cannot unmarshal !!map into []string 

What is the expected behaviour?

Metadata export should work

How to reproduce the issue?

My databases.yaml (in my projects' metadata/databases)

- name: imaginary-db
  kind: postgres
  configuration:
    connection_info:
      database_url:
        from_env: PG_DB_CONNECTION_URL
      isolation_level: read-committed
      pool_settings:
        connection_lifetime: 60
        total_max_connections: 10
      use_prepared_statements: false
  tables: "!include imaginary-db/tables/tables.yaml"
  functions: "!include imaginary-db/functions/functions.yaml"

Download the v2.32.1 binary:

$ ./cli-hasura-darwin-arm64 version && ./cli-hasura-darwin-arm64 --envfile ../.env metadata export --project hasura --log-level DEBUG
INFO hasura cli                                    version=v2.32.1
DEBU global config file exists, verifying contents 
DEBU global config is pre-set to &cli.GlobalConfig{UUID:"2c7618a3-e384-4bd2-84b6-dcef928f2edb", EnableTelemetry:true, ShowUpdateNotification:true, CLIEnvironment:"default"} 
DEBU global config: uuid: 2c7618a3-e384-4bd2-84b6-dcef928f2edb 
DEBU global config: enableTelemetry: true         
DEBU global config: showUpdateNotification: true  
DEBU global config: cliEnvironment: default       
DEBU ENV vars read from: /Users/alecf/prompt-js/prompt-watch/.env 
DEBU versions: cli: [v2.32.1] server: [v2.32.1-cloud.1] 
DEBU compatibility check: [true] compatible CLI and Server 
DEBU graphql engine endpoint: https://imaginary-dev.hasura.app 
DEBU graphql engine admin_secret: ‹×›             
DEBU server: uuid: 876e1d60-c29e-40c4-8151-ddb28ac2e0eb 
DEBU telemetry: beamed                             fields.time=624.621625ms isError=true
DEBU failed to export metadata: cannot export sources from metadata: error parsing metadata 
object: sources
file: databases.yaml
error: yaml: unmarshal errors:
  line 1: cannot unmarshal !!map into []string  kind="other error" location="file: /workdir/cli/internal/metadataobject/sources/sources.go, line: 256" ops="[command: hasura metadata export.RunE commands.MetadataExportOptions.Run commands.metadataModeDirectoryHandler.Export projectmetadata.Handler.ExportMetadata sources.SourceConfig.Export]"
FATA[0000] failed to export metadata: cannot export sources from metadata: error parsing metadata 
object: sources
file: databases.yaml
error: yaml: unmarshal errors:
  line 1: cannot unmarshal !!map into []string 

But if I revert to v2.32.0, the export works:

./cli-hasura-darwin-arm64 version && ./cli-hasura-darwin-arm64 --envfile ../.env metad
ata export --project hasura --log-level DEBUG
INFO hasura cli                                    version=v2.32.0
DEBU global config file exists, verifying contents 
DEBU global config is pre-set to &cli.GlobalConfig{UUID:"2c7618a3-e384-4bd2-84b6-dcef928f2edb", EnableTelemetry:true, ShowUpdateNotification:true, CLIEnvironment:"default"} 
DEBU global config: uuid: 2c7618a3-e384-4bd2-84b6-dcef928f2edb 
DEBU global config: enableTelemetry: true         
DEBU global config: showUpdateNotification: true  
DEBU global config: cliEnvironment: default       
DEBU ENV vars read from: /Users/alecf/prompt-js/prompt-watch/.env 
DEBU versions: cli: [v2.32.0] server: [v2.32.1-cloud.1] 
DEBU compatibility check: [true] compatible CLI and Server 
DEBU graphql engine endpoint: https://imaginary-dev.hasura.app 
DEBU graphql engine admin_secret: ‹×›             
DEBU server: uuid: 876e1d60-c29e-40c4-8151-ddb28ac2e0eb 
DEBU cli-ext: setting up using cli-ext embedded in cli binary 
DEBU output: {"success":true,"output_file_path":"/var/folders/w_/b7kb19452pz062ssq59rytnc0000gn/T/619559982.json"}  command="sdl to"
INFO Metadata exported                            
DEBU telemetry: beamed                             fields.time=621.546375ms isError=false

Also note that v2.33.0 and v2.33.1 both exhibit this problem, and v2.30 and v2.31 do not exhibit this problem. So this was introduced in v2.32.1 and has not been fixed.

Screenshots or Screencast

see above for logs

Please provide any traces or logs that could help here.

Any possible solutions/workarounds you're aware of?

Sticking with v2.32.0

Keywords

yaml, parsing, metadata, export, binary, cloud

Metadata

Metadata

Assignees

No one assigned

    Labels

    k/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions