deep-foundation / deep-foundation/dev

Fatal Error in HASURA_GRAPHQL_JWT_SECRET Parsing

Open
#241 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
20
Forks
18
PR merge metrics
No merged PRs in 30d

Description

**Issue Title**: `HASURA_GRAPHQL_JWT_SECRET` Variable Parsing Error During Deep Setup

**Description**:
During the setup of a Deep instance on a server, the `HASURA_GRAPHQL_JWT_SECRET` environmental variable causes a fatal error, preventing the Hasura container from starting up correctly. The error indicates that the JWT_SECRET variable is not recognized as valid JSON.

**Steps to Reproduce**:
1. Set up a server environment (Ubuntu).
2. Install required packages and dependencies (Docker, NVM, Node.js):

```bash
sudo apt update
sudo apt install -y git curl docker.io docker-compose
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 18 && nvm alias default 18 && nvm use default
npm i -g npm@latest
```

3. Generate the `JWT_SECRET` value:

```bash
export JWT_SECRET=$(node -e "console.log(JSON.stringify({type: 'HS256', key: require('crypto').randomBytes(50).toString('base64')}))")
```

4. Update the `call-options.json` to include the JWT_SECRET:

```json
{
"operation": "run",
"envs": {
"DEEPLINKS_PUBLIC_URL": "http://your.deeplinks.host",
"NEXT_PUBLIC_DEEPLINKS_URL": "http://your.deeplinks.host",
"NEXT_PUBLIC_GQL_PATH": "your.deeplinks.host/gql",
"NEXT_PUBLIC_GQL_SSL": "0",
"NEXT_PUBLIC_DEEPLINKS_SERVER": "http://your.deepcase.host",
"NEXT_PUBLIC_ENGINES_ROUTE": "0",
"NEXT_PUBLIC_DISABLE_CONNECTOR": "1",
"JWT_SECRET": "'{\"type\":\"HS256\",\"key\":\"\"}'",
"DEEPLINKS_HASURA_STORAGE_URL": "http://host.docker.internal:8000/",
"HASURA_GRAPHQL_ADMIN_SECRET": "",
"MIGRATIONS_HASURA_SECRET": "",
"DEEPLINKS_HASURA_SECRET": "",
"POSTGRES_PASSWORD": "",
"HASURA_GRAPHQL_DATABASE_URL": "postgres://postgres:@postgres:5432/postgres",
"POSTGRES_MIGRATIONS_SOURCE": "postgres://postgres:@host.docker.internal:5432/postgres?sslmode=disable",
"RESTORE_VOLUME_FROM_SNAPSHOT": "0",
"MANUAL_MIGRATIONS": "1",
"MINIO_ROOT_USER": "",
"MINIO_ROOT_PASSWORD": "",
"S3_ACCESS_KEY": "",
"S3_SECRET_KEY": ""
}
}
```

5. Follow the remaining steps to set up and start the Deep instance.

**Expected Result**:
The Deep instance should start correctly, with all containers running and able to process requests.

**Actual Result**:
The `deep-hasura` container fails to start, citing JSON formatting errors for the `HASURA_GRAPHQL_JWT_SECRET` variable.

**Error Logs**:
```plaintext
docker logs deep-hasura
Fatal Error:- Environment variable HASURA_GRAPHQL_JWT_SECRET: Error in $: Failed reading: not a valid json value
```

**Environment**:
- OS: Ubuntu 20.04
- Node.js version: 18.19.0
- Docker version: 20.10.7
- NVM version: v0.39.3

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.