hasura / hasura/graphql-engine
"invalid port number" when starting hasura-graphql-engine container deployed via ARM template
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.0.10
### Environment
Azure Cloud, trying out one-click deployment with new database as seen in https://hasura.io/docs/latest/graphql/core/deployment/deployment-guides/azure-container-instances-postgres.html
### What is the expected behaviour?
Azure console becomes accessible after successful deployment
### Keywords
azure, arm, template, hasura, port number invalid
### What is the current behaviour?
Deployment succeeds, but the `hasura-graphl-engine` container fails to start up. The logs end with the following error output shown below.
### How to reproduce the issue?
1. Open https://hasura.io/docs/latest/graphql/core/deployment/deployment-guides/azure-container-instances-postgres.html
2. Click "Deploy to Azure" button to open Azure portal
3. Sign in with your Azure account if necessary
4. Fill in ARM template form with values shown below
5. Click _Review+Create_ and _Create_ to start deployment
6. Wait for deployment to finish successfully
7. Navigate to deployed container instance and see logs to find error messages shown below
### Please provide any traces or logs that could help here.
I fill the provided ARM template with the following values:
- name: hasura-pg
- postgresVersion: 11
- postgresPricingTier: GeneralPurpose
- postgresCPUCores: 2
- postgresDiskSizeInMB: 10240
- postgresAdminUsername: hasura
- postgresAdminPassword: MyRelativelyLongAlphaNumericPassword123
- postgresDatabaseName: hasura
The log for the container instance running Hasura ends with the following output:
```
{"type":"startup","timestamp":"2021-10-21T13:41:40.186+0000","level":"info","detail":{"kind":"postgres_connection","info":{"error":"parsing database url failed"}}}
{"type":"pg-client","timestamp":"2021-10-21T13:41:40.186+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(0)."}}
{"type":"pg-client","timestamp":"2021-10-21T13:41:40.186+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(1)."}}
{"type":"startup","timestamp":"2021-10-21T13:41:40.186+0000","level":"error","detail":{"kind":"catalog_migrate","info":{"internal":"invalid port number: \"MyRelativelyLongAlphaNumericPassword123@hasura-pg-pg-server.postgres.database.azure.com:5432\"\n","path":"$","error":"connection error","code":"postgres-error"}}}
{"internal":"invalid port number: \"MyRelativelyLongAlphaNumericPassword123@hasura-pg-pg-server.postgres.database.azure.com:5432\"\n","path":"$","error":"connection error","code":"postgres-error"}
```
### Any possible solutions?
It seems that the first colon character is used to separate user name and hostname and only the second colon character is followed by the port number, like in this example:
`DB_URL="postgres://hasura%40$DB_SERVER_NAME:$DB_SERVER_ADMIN_PASSWORD@$DB_SERVER_NAME.postgres.database.azure.com:5432/$DB_NAME"`
Could it be that the parser does not accept this URL syntax and a different variation needs to be chosen?
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
Contributor guide
Research direction
Start with the Azure deployment guide and its ARM template, then inspect the DB_URL value shown in the report against the startup log's invalid-port error. Confirm whether the template produces a valid PostgreSQL connection URL and verify that the deployed Hasura container starts successfully and exposes the Azure console.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, postgresql
- Domain
- backend, cloud, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100