Skip to content

Cannot read property 'connectionConfig' of undefined #84

@pmiklos

Description

@pmiklos

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)

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