hasura / hasura/graphql-engine

Console not handling "--console-hge-endpoint" properly

Open
#10,136 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

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

### Environment
OSS Docker image

### What is the current behaviour?
I am running Hasura in a Docker compose stack running as a local dev environment. The command line is `hasura-cli console --address 0.0.0.0 --no-browser --console-hge-endpoint http://local.somedomain.io/`.

I can access and use the console on `http://localhost:9695/console` just fine. However, looking at the network inspector, there are multiple failing requests to bogus endpoint `http://v1/graphql`.

image

### What is the expected behaviour?

These failing requests should succeed, using `--console-hge-endpoint` as the base URL.

### How to reproduce the issue?

The HGE endpoint goes through an Nginx container which routes to HGE. The nginx config:
```
server {
listen 80;
http2 on;
underscores_in_headers on;
gzip on;
gzip_proxied any;
gzip_types text/plain application/xml;
gunzip on;
location /v1 {
proxy_pass http://hasura:8080/v1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /v2 {
proxy_pass http://hasura:8080/v2;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
```

The compose services are:
```
hasura:
image: v2.37.0-ce.cli-migrations-v3
command: ["/bin/bash", "-c", "/hasura-finish-startup.sh"]
ports:
- "9695:9695"
- "9693:9693"
volumes:
- ${SRC_DIR}/somedir/config.yaml:/config.yaml
- ${SRC_DIR}/somedir/hasura-finish-startup.sh:/hasura-finish-startup.sh

nginx:
restart: unless-stopped
image: nginx:${NGINX_DOCKER_TAG:-1.25.3-alpine}
ports:
- "80:80"
```

hasura-finish-startup.sh:
```
#!/bin/bash

function wait_for_port () {
local PORT=$1
echo Waiting for port $PORT
while ! nc -z localhost $PORT; do
sleep 0.1
done
echo Port $PORT is listening
}

graphql-engine serve &
wait_for_port 8080
cd /
hasura-cli console --address 0.0.0.0 --no-browser --console-hge-endpoint http://local.somedomain.io/
wait
```

### Screenshots or Screencast

See above

### Please provide any traces or logs that could help here.

N/A

### Any possible solutions/workarounds you're aware of?

None I'm aware of

### Keywords

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the hasura-cli console entry point and trace how --console-hge-endpoint is passed into the console; reproduce with the provided Docker Compose and Nginx setup while inspecting requests to http://v1/graphql. Done when those requests use http://local.somedomain.io/ as their base URL and succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, typescript
Domain
cli, frontend
Issue type
Bug
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.