Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hasura console fails to launch when using --insecure-skip-tls-verify #4926

Closed
pradyuman opened this issue May 29, 2020 · 19 comments
Closed

Hasura console fails to launch when using --insecure-skip-tls-verify #4926

pradyuman opened this issue May 29, 2020 · 19 comments
Assignees
Labels
a/collab-ci-cd c/cli Related to CLI k/bug Something isn't working

Comments

@pradyuman
Copy link

I get the error "Invalid admin-secret passed from CLI" when trying to use the console UI with the --insecure-skip-tls-verify flag.

The other cli commands run just fine (e.g. migrate apply) but I cannot access the console UI.

@scriptonist scriptonist added c/cli Related to CLI k/bug Something isn't working labels May 29, 2020
@scriptonist
Copy link
Contributor

@pradyuman this seems to be working on my end 🤔 can you provide a bit more info so that I can reproduce ?
image

@scriptonist scriptonist added the support/needs-more-info Needs more details/info/repro instructions label Jun 2, 2020
@ste824
Copy link

ste824 commented Jul 10, 2020

@scriptonist I get the same as you on the cmd, but then when I go to http://localhost:9695/ in a browser I get this, which sounds like the same thing as @pradyuman
image

@pradyuman
Copy link
Author

Yep, this is exactly what happens to me as well.

@scriptonist scriptonist removed the support/needs-more-info Needs more details/info/repro instructions label Jul 20, 2020
@galipmedia
Copy link

Same here all other CLI things work fine only console fails with invalid password no matter what I try.

@divramod
Copy link

same problem here. what could be the problem?

@pkong-ds
Copy link

Same problem here. All commands except hasura console work fine with the provided admin secret in config.yaml file.

@rlanyi
Copy link

rlanyi commented Feb 7, 2021

for me it doesn't even work if I provide the admin secret with --admin-secret

my version is:

bash-5.0# hasura version
INFO hasura cli                                    version=v1.3.3
INFO hasura graphql engine                         endpoint="http://hasura:8080" version=v1.3.3

@andreikaralkou
Copy link

Same problem for me. Doesn't work hasura console

@sergiogcx
Copy link

Try removing (or adjusting) the HASURA_GRAPHQL_CORS_DOMAIN env var. I ran into this problem a few moments ago, after playing a bit with the environment variables I found that I had a strict CORS policy. That's what worked for me anyways.

@brancusi
Copy link

brancusi commented Apr 6, 2021

Same problem here. This is only happening on v2. Have tried many variations. Any ideas?

@marbemac
Copy link

For us we had HASURA_GRAPHQL_DISABLE_CORS: 'true' which broke the cli console - removing that when we need to use the console fixed the issue for us.

@samuela
Copy link
Contributor

samuela commented Nov 9, 2021

Same here. I get this issue when trying to run hasura console on a remote NixOS machine and connect through SSH. When running locally on macOS I don't see this error.

Complicating matters is the fact there are no logs anywhere with the issue, even when running with HASURA_GRAPHQL_LOG_LEVEL: "debug".

At least it'd be nice to get a correct error message. It's clearly not an invalid admin-secret issue...

@samuela
Copy link
Contributor

samuela commented Nov 9, 2021

Setting HASURA_GRAPHQL_CORS_DOMAIN="*" doesn't make any difference for me.

@samuela
Copy link
Contributor

samuela commented Nov 10, 2021

Just talked about this issue in office hours... Mysteriously my issue went away! Not 100% clear what changed. There were some package upgrades, though they should've been inconsequential.

I'll report back if I manage to reproduce the issue!

@samuela
Copy link
Contributor

samuela commented Nov 10, 2021

... and it's back! No idea what changed. Everything about my environment is the same, running all the same commands the same as I did during office hours...

EDIT: did a bit more poking around... I have two machines: laptop and a remote machine called doodoo. I'm attempting to run hasura console on doodoo, and then connect to it from laptop. One thing that I've noticed is that the --endpoint must be accessible from laptop. So

hasura console --address=0.0.0.0 --endpoint=http://localhost:8080/

gives me an error when I try to access http://doodoo:9695/console/login: "Hasura console is not able to reach your Hasura GraphQL engine instance. Please ensure that your instance is running and the endpoint is configured correctly." as well as "Invalid admin-secret passed from CLI"

But

hasura console --address=0.0.0.0 --endpoint=http://doodoo:8080/

only gives me the "Invalid admin-secret passed from CLI" error.

Also, I can be certain that my secret is valid since if I intentionally pass in an incorrect secret via --admin-secret I get a different error altogether:

[nix-shell:~/dev/cuddlefish/hasura]$ hasura console --address=0.0.0.0 --endpoint=http://doodoo:8080/ --admin-secret=incorrect
FATA[0000] {
  "path": "$",
  "error": "invalid x-hasura-admin-secret/x-hasura-access-key",
  "code": "access-denied"
}

EDIT EDIT: I think I figured out why it worked in office hours but not otherwise... I believe the difference is that I was accidentally running two hasura instances one on the doodoo and one on laptop. I'm still not able to come up with a 100% reliable reproduction however.

@CKnoppas
Copy link

CKnoppas commented Dec 16, 2021

ran into the same issue after migrating from v1.x.x to v2.x.x... what worked for me was setting a different --console-port and --no-browser. Maybe you try playing around with that.

INFO hasura cli                                    version=v2.1.0
INFO hasura graphql engine                         endpoint="http://localhost:8080" version=v2.1.0

so i ran hasura console --console-port 9090 and that fixed the issue for me
i assume --no-browser flag has no effect here

@purush7 purush7 assigned purush7 and unassigned purush7 Jan 4, 2022
@purush7
Copy link
Contributor

purush7 commented Jan 5, 2022

The below process can act as a workaround solution

  • Make sure to passHASURA_GRAPHQL_CORS_DOMAIN env var with value http://localhost:9695 in the case of graphql-engine endpoint being a different origin than localhost
  • execute hasura console
  • If there is an error message x509: certificate signed by unknown authority, make the certificate a trusted one
  • If there isn't any error messages, go to http://localhost:9695/console in the preferred browser.

The response in #4926 (comment) occurs for the endpoint
http://localhost:9695/console/login and I think http://localhost:9695 is getting redirected to http://localhost:9695/console/login (ref:#4926 (comment))

@samuela (regarding:#4926 (comment)) http://localhost:9695/console is the correct page for cli-console and http://localhost:9695/console/login displays the error message for cli-console

@scriptnull scriptnull removed their assignment Jan 5, 2022
@purush7
Copy link
Contributor

purush7 commented Jan 6, 2022

This can be a temporary workaround solution after making the self-signed certificates as trusted and addition of http://localhost:9695 to HASURA_GRAPHQL_CORS_DOMAIN
and here the reason behind is browser blocking the API because of a self-signed certificate
Here https://app.hasura.local is server endpoint proxy

Screen.Recording.2022-01-06.at.5.48.07.PM.mov

@purush7 purush7 removed their assignment Jan 22, 2022
@akvilibrium
Copy link

Yeah. For me too, the problem was the disabling cors option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/collab-ci-cd c/cli Related to CLI k/bug Something isn't working
Projects
None yet
Development

No branches or pull requests