I made a small nestjs webapp, it connects to a local mssql database and works fine... Except if I try to launch it using pm2.
- regular
yarn start:dev
works (it translates tonest start --watch
) - building the production and running
yarn start:prod
also works fine (it translates tonode dist/main
) - running
nodemon build/main.js
also works fine
But if I try to launch my app running pm2 start build/main.js
I get DB connection errors: TypeError: The "config.server" property is required and must be of type string
.
My DB connection parameters are currently stored in a .env file. I load them running env.config()
and it's working fine for the other three running methods I listed. I've tried to change the parameters to include quotes and double quotes, with no luck:
db_host = localhost
db_host = 'localhost'
db_host = "localhost"
What am I doing wrong?