Skip to content

typeorm cli migrate:run port issue getting "config.options.port" property must be of type number. #6781

@GLakshmiSravanthi

Description

@GLakshmiSravanthi

Issue type:

[x ] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[x ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x ] latest
[ ] @next
[ ] 0.x.x (or put your version here)

While running the yarn ts-node ./node_modules/typeorm/cli.js migration:run facing error
We are using .env file, which has the typeORM configuration.

error

Configarations we placed


TYPEORM_CONNECTION=mssql
TYPEORM_HOST=localhost
TYPEORM_PORT=1443
TYPEORM_USERNAME=XXXX
TYPEORM_PASSWORD=XXXX
TYPEORM_DATABASE=test
TYPEORM_SYNCHRONIZE=false
TYPEORM_LOGGING=error
TYPEORM_LOGGER=advanced-console

this our script file from here we are running db.migrate
image

Solutions we tried

[ * ] This is our folder structure placed .env file and ormconfig.json are in same folder but when we are running migrations command it is taking .env file not ormconfig.json
image

[ * ] We tried to giving yarn ts-node ./node_modules/typeorm/cli.js migration:run -f ormconfig.json but we are unable to compile
image

[ * ] But by renaming the .env file we are able to compile the command yarn ts-node ./node_modules/typeorm/cli.js migration:run -f ormconfig.json
image

[ * ] We tried pass our .env file as configuration, it results the same error
image

[ * ] Checked in the typeorm git repo in that ConnectionOptionsEnvReader() is reading the env variables and in that port is read from port: PlatformTools.getEnvVariable("TYPEORM_PORT"), . getEnvVariables is returning a string.
Which may be causing the issue ?
Please help

Thankyou For advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions