hasura / hasura/graphql-engine

cli: suggest using --admin-secret key when hasura init endpoint validation fails

Open
#8,197 0 comments 0 reactions 0 assignees View on GitHub
c/cli t/product-platform
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

when trying to initialize a hasura cli project with endpoint, I faced the below error.

```
$ hasura init check-2 --endpoint https://premium-feline-58.hasura.app
? Initialize project with metadata & migrations from https://premium-feline-58.hasura.app ? Yes
INFO validating endpoint failed, server not reachable
INFO directory created. execute the following commands to continue:

cd /home/scriptnull/hasura/t/check-2
hasura console
```

I was wondering why this would happen for a while and adding `--admin-secret` arg to the init command fixed the problem.

### Describe the solution you'd like

So maybe we add a suggestion when CLI faces a` validating endpoint failed, server not reachable` error to ask the user to try using the admin secret flag.

Also note that the CLI did not fail when the validation failed, instead it continued creating the project. Is it the expected behaviour?

### Describe alternatives you've considered

n/a

### If the feature is approved, would you be willing to submit a PR?

yes

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `hasura init` command with an endpoint that fails validation, then trace where the CLI reports `validating endpoint failed, server not reachable`. Done means the CLI suggests trying `--admin-secret` and the behavior of continuing after validation failure is clarified.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.