hasura / hasura/graphql-engine
cli-ext no such file or directory on cloud build
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: v2.3.1
CLI Version (for CLI related issue): Dev?
### Environment
Hasura in cloud run
hasura-cli in cloud build
### What is the expected behaviour?
I expect hasura cli to be able to apply metadata on the cloud run instance
### Keywords
cli-ext
no such file or directory
error in converting sdl to metadata
### What is the current behaviour?
I use nix, when I run the CLI locally connected to the cloud run hasura, I have no problem applying metadata. But when It's in cloud build it throws this error:
```
error applying metadata \ncannot build actions from project: error parsing metadata \nobject: actions\nfile: actions.yaml\nerror: error in converting sdl to metadata: fork/exec /builder/home/.hasura/cli-ext/dev/cli-ext-572389094/cli-ext: no such file or directory:
```
### How to reproduce the issue?
1. Set up hasura on a cloud run thats open to all traffic (if you dont then you need to set up some gcp auth)
2. Add cloud build with a step with `nix-shell -p hasura-cli --run 'hasura metadata apply --endpoint=${cloud run url}'`
3. Run it
### Please provide any traces or logs that could help here.
```
{"level":"debug","msg":"global config is pre-set to \u0026cli.GlobalConfig{UUID:\"REDACTED\", EnableTelemetry:true, ShowUpdateNotification:true, CLIEnvironment:\"default\"}","time":"2022-04-26T20:48:30Z"}
{"level":"debug","msg":"cannot get config information from server, this might be because config API is not enabled: json: cannot unmarshal array into Go struct field HasuraServerInternalConfig.jwt of type string","time":"2022-04-26T20:48:33Z"}
{"level":"debug","msg":"versions: cli: [dev] server: [v2.3.1]","time":"2022-04-26T20:48:33Z"}
{"level":"debug","msg":"compatibility check: [true] dev version of cli, there could be inconsistencies","time":"2022-04-26T20:48:33Z"}
{"level":"debug","msg":"server: uuid: REDACTED","time":"2022-04-26T20:48:33Z"}
{"level":"info","msg":"Applying metadata...","time":"2022-04-26T20:48:33Z"}
{"level":"debug","msg":"building metadata: functions node not found for default","time":"2022-04-26T20:48:33Z"}
{"level":"warning","msg":"Unable to find an embedded cli-ext. So trying to fetch it from CDN","time":"2022-04-26T20:48:33Z"}
{"level":"warning","msg":"Tip: --cli-ext-path can be used for setting up cli-ext from local file system","time":"2022-04-26T20:48:33Z"}
"command":"sdl from","level":"debug","msg":"output: ","time":"2022-04-26T20:48:34Z"}
"apply-metadata": time="2022-04-26T20:48:34Z" level=fatal msg="error applying metadata \ncannot build actions from project: error parsing metadata \nobject: actions\nfile: actions.yaml\nerror: error in converting sdl to metadata: fork/exec /builder/home/.hasura/cli-ext/dev/cli-ext-572389094/cli-ext: no such file or directory: "
```
### Any possible solutions?
My alternative would be to switch to using curl, which I do not want to do
### Can you identify the location in the source code where the problem exists?
I assumed somewhere in metadata apply its using cli-ext to convert yaml to json?
### If the bug is confirmed, would you be willing to submit a PR?
I could give it a shot
### Related
https://github.com/hasura/graphql-engine/issues/6441
I've tried several proposed solutions, such as removing ~/.hasura and clearing NODE_OPTIONS (it was empty anyways)
And I ruled out version mismatch because I am using the same version locally and on cloud build and it works locally
Contributor guide
Assessment
This issue has not been assessed yet.