Skip to content

Worker fails to find ENV var and crashes #6

@whoabuddy

Description

@whoabuddy

I can reproduce this issue in 2203a53 both locally and using the Render deployment. Both versions of the worker are crashing with:

Error: Missing required ENV variable: SUPPLIER_NETWORK

Local example:

/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/src/config.ts:33
    if (!value) throw new Error(`Missing required ENV variable: ${key}`);
                ^

Error: Missing required ENV variable: SUPPLIER_NETWORK
    at getEnv (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/src/config.ts:12:21)
    at Object.getNetworkKey (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/src/config.ts:72:10)
    at redisKeyPrefix (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/src/store.ts:2:41)
    at Object.createRedisClient (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/src/store.ts:33:21)
    at Object.initWorkerThread (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/src/worker/index.ts:10:92)
    at Object.<anonymous> (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/scripts/worker.ts:1:49)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module._compile (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/node_modules/pirates/lib/index.js:136:24)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.newLoader [as .ts] (/home/whoabuddy/Dev/bitcoin/magicstx/supplier-server/node_modules/pirates/lib/index.js:141:7)
error Command failed with exit code 1.

Render example:

image

The value is definitely set in the config and worked with yarn register-supplier without issue.

Here is the output of yarn check-config:

Server config:
    btcAddress: "mnSTuSa13UzgrVLkBhutU1u7s36ez4sRFw"
    stxAddress: "ST1BHYY1HNHM9MZXSTW9NVGNPGBF5S108D6H1CEP"
    btcNetwork: "testnet"
    operatorId: 3
    electrumConfig: {
      "host": "blackie.c3-soft.com",
      "port": 57006,
      "protocol": "ssl"
    }
    topic: "start"

Configured contracts:
    bridge: "ST2ZTY9KK9H0FA0NVN3K8BGVN6R7GYVFG6BE7TAR1.bridge"
    xbtc: "ST2ZTY9KK9H0FA0NVN3K8BGVN6R7GYVFG6BE7TAR1.Wrapped-Bitcoin"
    network: "testnet"
    btc: 1.25321
    stx: 49999

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions