Closed
Description
I'm submitting a...
- Bug report
- Feature request
- Question
Current behavior
When Node.js application is started by node --use_strict index.js
, it fails on dbMigrateInstance.up()
call with the following error and stacktrace:
[ERROR] TypeError: Cannot read property 'isSilent' of null
at exports.sql (/media/data/repositories/coding/noodle-backend/node_modules/db-migrate-shared/log.js:70:14)
at Object.all (/media/data/repositories/coding/noodle-backend/node_modules/db-migrate-pg/index.js:616:18)
at Object.createMigrationsTable (/media/data/repositories/coding/noodle-backend/node_modules/db-migrate-pg/index.js:163:17)
at /media/data/repositories/coding/noodle-backend/node_modules/db-migrate/lib/commands/up.js:28:25
at /media/data/repositories/coding/noodle-backend/node_modules/db-migrate/connect.js:100:7
at /media/data/repositories/coding/noodle-backend/node_modules/db-migrate/lib/driver/index.js:104:7
at /media/data/repositories/coding/noodle-backend/node_modules/db-migrate-pg/index.js:655:5
at Connection.<anonymous> (/media/data/repositories/coding/noodle-backend/node_modules/pg/lib/client.js:178:7)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:121:20)
at Connection.emit (events.js:211:7)
at Socket.<anonymous> (/media/data/repositories/coding/noodle-backend/node_modules/pg/lib/connection.js:124:12)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
When application is started without --use_strict
parameter, this error does not appear.
Expected behavior
When Node.js application is started by node --use_strict index.js
, it doesn't fail.
Minimal reproduction of the problem with instructions
File index.js
:
const dbMigrate = require('db-migrate');
async function runMigration() {
const dbMigrateInstance = dbMigrate.getInstance(true, {
config: 'database.json',
env: 'dev'
});
await dbMigrateInstance.up();
}
runMigration()
.catch((err) => console.log(err));
File database.json
:
{
"dev": {
"driver": "pg",
"user": "user",
"password": "password",
"host": "localhost",
"port": 5432,
"database": "db"
}
}
Run from the command line:
node --use_strict index.js
What is the motivation / use case for changing the behavior?
Bug should be fixed.
Environment
db-migrate version: 0.11.3
db-migrate-pg version: 0.4.0
Additional information:
- Node version: 8.12.0
- Platform: Ubuntu 16.04 LTS