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

Cannot read property 'connectionConfig' of undefined #84

Closed
pmiklos opened this issue Feb 18, 2018 · 3 comments
Closed

Cannot read property 'connectionConfig' of undefined #84

pmiklos opened this issue Feb 18, 2018 · 3 comments

Comments

@pmiklos
Copy link
Contributor

pmiklos commented Feb 18, 2018

The latest git version of byteballcore fails on startup when used with mysql. The issue is in function initUnstableUnit where db.escape is used as a mapper function, but the escape function refers to this which in this usage gets the wrong context:

"SELECT parent_unit, child_unit FROM parenthoods WHERE child_unit IN("+Object.keys(assocUnstableUnits).map(db.escape)+")",

the fix is converting it to a function call:

.map(function() { return db.escape(); })

The Error:

node_modules/mysql/lib/protocol/Parser.js:80
        throw err; // Rethrow non-MySQL errors
        ^

TypeError: Cannot read property 'connectionConfig' of undefined
    at Pool.escape (node_modules/mysql/lib/Pool.js:281:42)
    at Array.map (<anonymous>)
    at node_modules/byteballcore/storage.js:1248:108
    at Query._callback (node_modules/byteballcore/mysql_pool.js:43:4)
    at Query.Sequence.end (node_modules/mysql/lib/protocol/sequences/Sequence.js:88:24)
    at Query._handleFinalResultPacket (node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
    at Query.EofPacket (node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
    at Protocol._parsePacket (node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (node_modules/mysql/lib/protocol/Protocol.js:39:16)

@tonyofbyteball
Copy link
Member

the above commit should be a better fix, we use .map(db.escape) quite often

@tonyofbyteball
Copy link
Member

Does the issue persist in the most recent version? I don't reproduce it now.

@pmiklos
Copy link
Contributor Author

pmiklos commented Sep 3, 2018

not sure to be honest, I switched back to using SQLite. But I don't remember this issue coming up a couple of months ago when I still used MySQL.

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

No branches or pull requests

2 participants