Problem with REDIS PORT being returned as NaN

toddcornett
FREE

3 days ago

Getting this error trying to use the REDIS service and the service variables provided. The build and deployment for both the custom service and the REDIS service work fine but the runtime crashes with the following error:

node:net:1330

validatePort(port);

^

RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536. Received type number (NaN).

at lookupAndConnect (node:net:1330:5)

at Socket.connect (node:net:1285:5)

at connect (node:net:245:17)

at /app/node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/StandaloneConnector.js:54:66

at process.processTicksAndRejections (node:internal/process/task_queues:85:11) {

code: 'ERR_SOCKET_BAD_PORT'

}

Node.js v22.18.0

and here is my variable configuration:

NODE_ENV="production"

POSTGRES_HOST="${{Postgres.PGHOST}}"

POSTGRES_PORT="${{Postgres.PGPORT}}"

POSTGRES_NAME="${{Postgres.POSTGRES_DB}}"

POSTGRES_USER="${{Postgres.POSTGRES_USER}}"

POSTGRES_PASSWORD="${{Postgres.POSTGRES_PASSWORD}}"

DATABASE_URL="${{Postgres.DATABASE_URL}}"

REDIS_HOST="{{Redis.REDISHOST}}"

REDIS_PASSWORD="${{Redis.REDIS_PASSWORD}}"

REDIS_PORT="{{Redis.REDISPORT}}"

REDIS_USERNAME="{{Redis.REDISUSER}}"

API_KEY="SECRET"

Awaiting Railway Response$10 Bounty

2 Replies

smolpaw
HOBBYTop 10% Contributor

2 days ago

Your REDIS_HOST, REDIS_PORT and REDIS_USERNAME variables are missing the dollar sign


smolpaw

Your REDIS_HOST, REDIS_PORT and REDIS_USERNAME variables are missing the dollar sign

toddcornett
FREE

2 days ago

Thank you!!! Dumb oversight by me but thanks for pointing it out.