I receive "ERROR: Port should be >= 0 and < 65536. Received NaN." on Elastic Beanstalk

Open
#1,271 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js, postgresql
Domain
cli, database

Research direction

Start with settings.json and the npx sequelize-cli db:migrate --env production entry point, then trace how the production database configuration is loaded and how the port value is parsed. Reproduce the Elastic Beanstalk setup using the reported Node, CLI, and ORM versions; done means the migration command accepts the configured port without producing NaN.

Written by the indexing model from the issue text.

Description

What you are doing?

I'm trying to run npx sequelize-cli db:migrate --env production on an Elastic Beanstalk Node.js instance. The database settings are

  "production": {
    "username": "process.env.RDS_USERNAME",
    "password": "process.env.RDS_PASSWORD",
    "database": "process.env.RDS_DB_NAME",
    "host": "process.env.RDS_HOSTNAME",
    "port": "process.env.RDS_PORT",

What is actually happening?

When I attempt to run the command, I get the following output

npx sequelize-cli db:migrate --env production

Sequelize CLI [Node: 14.18.1, CLI: 6.6.0, ORM: 6.21.0]

Loaded configuration file "settings.json".
Using environment "production".

ERROR: Port should be >= 0 and < 65536. Received NaN.

I've logged process.env.RDS_PORT and am getting the following

console.log('process.env.RDS_PORT', process.env.RDS_PORT)
process.env.RDS_PORT 5432

Dialect: postgres
Sequelize CLI version: 6.6.0
Sequelize version: 6.21.0

Dominant language
JavaScript
Stars
2.6k
Forks
524
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sequelize/cli

All issues in sequelize/cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.