hasura / hasura/graphql-engine

Hasura ignores http protocol in environment variable https_proxy

Open
#9,885 0 comments 0 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version:v2.33.0
CLI Version (for CLI related issue):

### Environment

WSL/Ubuntu 22.04.2 LTS

### What is the current behaviour?

When using https_proxy environment variable, which has http protocol (not https) in the URL, Hasura seems to use an URL which has https protocol (not http) and fails to start. For example when using environment variable:

https_proxy=http://address:port

there are log entries like:

_hasura-graphql-engine-1 | graphql-engine: HttpExceptionContentWrapper {unHttpExceptionContentWrapper = InvalidProxyEnvironmentVariable "https_proxy" "https://address:port"}_

In the log the URL is wrong because it has https instead of http.

### What is the expected behaviour?

The protocol in the environment variable should be used.

### How to reproduce the issue?

1. Set up proxy.
2. Add environment variable: export https_proxy=http://address:port
3. Start Hasura: docker compose up

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

hasura-data-connector-agent-1 | {"timestamp":"2023-09-15T09:54:11.985Z","sequence":108,"loggerClassName":"org.jboss.logmanager.Logger","loggerName":"io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter","level":"SEVERE","message":"Failed to export spans. The request could not be executed. Full error message: Failed to connect to localhost/127.0.0.1:4317","threadName":"OkHttp http://localhost:4317/...","threadId":33,"mdc":{},"ndc":"","hostName":"beabf7916028","processName":"super-connector.jar","processId":1}
hasura-graphql-engine-1 | {"detail":{"info":{"admin_secret_set":true,"auth_hook":null,"auth_hook_mode":null,"console_assets_dir":null,"console_sentry_dsn":null,"cors_config":{"allowed_origins":"*","disabled":false,"ws_read_cookie":null},"enable_allowlist":false,"enable_console":true,"enable_maintenance_mode":false,"enable_metadata_query_logging":false,"enable_telemetry":true,"enabled_apis":["config","pgdump","metadata","graphql"],"enabled_log_types":["webhook-log","http-log","startup","query-log","websocket-log"],"events_fetch_batch_size":100,"experimental_features":[],"graceful_shutdown_timeout":60,"infer_function_permissions":true,"jwt_secret":[],"live_query_options":{"batch_size":100,"refetch_delay":1},"log_level":"info","port":8080,"remote_schema_permissions":false,"server_host":"HostAny","stringify_numeric_types":false,"transaction_isolation":"ISOLATION LEVEL READ COMMITTED","unauth_role":null,"use_prepared_statements":true,"v1-boolean-null-collapse":false,"websocket_compression_options":"NoCompression","websocket_connection_init_timeout":"Refined (Seconds {seconds = 3s})","websocket_keep_alive":"KeepAliveDelay {unKeepAliveDelay = Refined (Seconds {seconds = 5s})}"},"kind":"server_configuration"},"level":"info","timestamp":"2023-09-15T09:54:13.776+0000","type":"startup"}
hasura-graphql-engine-1 | {"detail":{"info":{"database_url":"postgres://postgres:...@postgres:5432/postgres","retries":1},"kind":"postgres_connection"},"level":"info","timestamp":"2023-09-15T09:54:13.776+0000","type":"startup"}
hasura-graphql-engine-1 | {"detail":{"info":"Already at the latest catalog version (48); nothing to do.","kind":"catalog_migrate"},"level":"info","timestamp":"2023-09-15T09:54:13.776+0000","type":"startup"}
hasura-graphql-engine-1 | graphql-engine: HttpExceptionContentWrapper {unHttpExceptionContentWrapper = InvalidProxyEnvironmentVariable "https_proxy" "https://proxy.company.com:3128"}
hasura-graphql-engine-1 exited with code 1

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

No

### Keywords

proxy

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with `https_proxy=http://address:port` and `docker compose up`, then trace Hasura's handling of the `https_proxy` environment variable. Done means the configured http protocol is preserved instead of being changed to https, and Hasura starts successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.