hasura / hasura/graphql-engine

Connection error: missing "=" after connection info string?

Open
#9,394 1 comment 4 reactions 0 assignees View on GitHub
k/bug t/product-platform
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.15.2
CLI Version (for CLI related issue): n/a

### Environment

OSS

### What is the current behaviour?

When passing in a value for `HASURA_GRAPHQL_DATABASE_URL` into my Docker image, the program expects an equals sign after my connection string info. However, when I define the environment variable `HASURA_GRAPHQL_DATABASE_URL` directly in the Dockerfile rather than passing value via `--env-file` flag, I do not get this problem.

### What is the expected behaviour?

I expect to not need an equals sign "=" anywhere in my connection info string.

### How to reproduce the issue?

1. Create Dockerfile:
```
FROM hasura/graphql-engine:v2.15.2

# copy metadata for GQL server to use version controlled configuration
COPY hasura-gql/metadata/ metadata
COPY hasura-gql/config.yaml config.yaml

# run-time args
ENV HASURA_GRAPHQL_ADMIN_SECRET=$HASURA_GRAPHQL_ADMIN_SECRET
ENV HASURA_GRAPHQL_DATABASE_URL=$HASURA_GRAPHQL_DATABASE_URL
```

2. Pass environment variables through command line:
```
$ docker build .
$ docker run --env-file .env
```

### Screenshots or Screencast

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

```
{"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":["startup","webhook-log","http-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-01-21T19:57:17.100+0000","type":"startup"}
{"detail":{"info":{"error":"parsing database url failed"},"kind":"postgres_connection"},"level":"info","timestamp":"2023-01-21T19:57:17.100+0000","type":"startup"}
{"detail":{"message":"postgres connection failed, retrying(0)."},"level":"warn","timestamp":"2023-01-21T19:57:17.100+0000","type":"pg-client"}
{"detail":{"message":"postgres connection failed, retrying(1)."},"level":"warn","timestamp":"2023-01-21T19:57:17.100+0000","type":"pg-client"}
{"detail":{"info":{"code":"postgres-error","error":"connection error","internal":"missing \"=\" after \"\"postgres://postgres:***@***:5432/***\"\" in connection info string\n","path":"$"},"kind":"catalog_migrate"},"level":"error","timestamp":"2023-01-21T19:57:17.100+0000","type":"startup"}
{"code":"postgres-error","error":"connection error","internal":"missing \"=\" after \"\"postgres://postgres:***@***:5432/***\"\" in connection info string\n","path":"$"}
```

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

It seems I could compromise security by injecting the connection string directly into the Dockerfile, but this is antithetical to environment variables too. So not quite any workarounds that I know of.

### Keywords

connection, missing

Contributor guide

Open the contributing guide

Research direction

Start with the Dockerfile and .env reproduction, then trace how HASURA_GRAPHQL_DATABASE_URL is passed from --env-file into PostgreSQL connection parsing. Confirm the failure in the provided startup logs and determine what change makes the same connection string work without an extra '='; done means the Docker --env-file setup starts successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, postgresql
Domain
databases, devops
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.