Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when running dbMigrateInstance.up() in strict mode #590

Closed
1 of 3 tasks
Restless-Anchoret opened this issue Oct 15, 2018 · 1 comment · May be fixed by db-migrate/shared#10
Closed
1 of 3 tasks

TypeError when running dbMigrateInstance.up() in strict mode #590

Restless-Anchoret opened this issue Oct 15, 2018 · 1 comment · May be fixed by db-migrate/shared#10
Labels

Comments

@Restless-Anchoret
Copy link

Restless-Anchoret commented Oct 15, 2018

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
@stale
Copy link

stale bot commented Nov 29, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant