db-migrate / db-migrate/english-docs

Chrome debugger within the js file?

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
17
Forks
45
PR merge metrics
No merged PRs in 30d

Description

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!](https://www.bountysource.com/issues/72630681-chrome-debugger-within-the-js-file?utm_campaign=plugin&utm_content=tracker%2F11704504&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F11704504&utm_medium=issues&utm_source=github).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.