In a straightforward local setup with docker-compose as described in the docs + local Hasura CLI, hasura metadata export is failing.
It works if I export it under root. So it could be some permission related issue.
I can't find better logging to know better what is going. If you can suggest some flags I can give more useful information.
Environment:
Full log:
$ hasura metadata export --log-level debug
DEBU global config file exisits, verifying contents
DEBU global config is pre-set to &cli.GlobalConfig{UUID:"99e3c3a9-43a9-4b4d-a5f8-954f306b43c7", EnableTelemetry:true, ShowUpdateNotification:true, CLIEnvironment:"default"}
DEBU global config: uuid: 99e3c3a9-43a9-4b4d-a5f8-954f306b43c7
DEBU global config: enableTelemetry: true
DEBU global config: showUpdateNotification: true
DEBU global config: cliEnvironment: default
DEBU graphql engine endpoint: http://localhost:8080
DEBU graphql engine admin_secret:
DEBU versions: cli: [v1.2.1] server: [v1.2.1]
DEBU compatibility check: [true] older cli version might not be compatible with latest server apis, please update cli
DEBU server: uuid: 1ba79630-8828-4d70-a6e5-39f50465307f
DEBU response: {"result_type":"TuplesOk","result":[["count"],["1"]]}
DEBU response: {"result_type":"TuplesOk","result":[["count"],["1"]]}
DEBU response: {"version":2,"tables":[{"table":{"schema":"public","name":"test"}}],"actions":[{"name":"actionName","definition":{"handler":"http://host.docker.internal:3000","output_type":"SampleOutput","arguments":[{"name":"arg1","type":"SampleInput!"}],"type":"mutation","kind":"synchronous"}}],"custom_types":{"input_objects":[{"name":"SampleInput","fields":[{"name":"username","type":"String!"},{"name":"password","type":"String!"}]}],"objects":[{"name":"SampleOutput","fields":[{"name":"accessToken","type":"String!"}]}]}}
DEBU output: command="sdl to"
DEBU telemetry: beamed fields.time=48.239749ms isError=true
FATA[0004] failed to export metadata: cannot export metadata from server: cannot export actions from metadata: error in converting metadata to sdl: exit status 4:
@davazp are you running the CLI inside a container ?
No, CLI is installed locally. I can try later to see if it makes a difference though.
I dug a bit deeper. I linked the CLI to a local version of the cli_ext plugin. It works when I replace it with a script that goes directly to the cli_ext's source code. It fails if I link it to the output binary (processed with pkg).
The pkg's output binary works for linux though. So it seems something is wrong with pkg on (my) mac os X.
I opened an issue in pkg to investigate further what it could be the reason: https://github.com/vercel/pkg/issues/921
The problem was pkg was breaking because I had NODE_OPTIONS env variable with some settings. Thanks for the help!
Most helpful comment
The problem was
pkgwas breaking because I had NODE_OPTIONS env variable with some settings. Thanks for the help!