Skip to content

Chrome debugger within the js file? #39

Description

@fr-nevin

I was wondering how to debug the data coming back from the then function within :


`exports.up = function(db) {
  var filePath = path.join(__dirname, 'sqls', '20190409095035-data-migration-region-up.sql');
  return new Promise( function( resolve, reject ) {
    fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
      if (err) return reject(err);
      console.log('received data: ' + data);
      resolve(data);
    });
  })
  .then(function(data) {
    **debugger**; // -> Wanted to put the chrome debugger here for node.js
    return db.runSql(data);
  });
};`

I tried something like:

node --inspect-brk config/migrations/20190409095035-data-migration-region.js

to get a hook in the file. It triggered the basic breakpoint, but once the command:

db-migrate up --migrations-dir config/migrations --config config/database.js --env dev

runs, it doesn't get hooked in the debug listener.

Any suggestions on how to get the instance to get hooked?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

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