Problem with REDIS PORT being returned as NaN
toddcornett
PROOP

10 months 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"

Solved$10 Bounty

Pinned Solution

smolpaw
HOBBY

10 months ago

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

2 Replies

smolpaw
HOBBY

10 months 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
PROOP

10 months ago

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


Status changed to Solved chandrika 10 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...