Skip to content

should the driver marshal iterable to array?  #329

Closed
@jasperblues

Description

@jasperblues
send(): Promise<number> {
    return new Promise((resolve, reject) => {
        this.profiles()
            .then(profiles => Promise.all(profiles.map(it => this.sendWelcomeMail(it))))
            .then(users => {
                const params = {ids: users.map(it => it.id)};
                console.log('Got params: ' + JSON.stringify(params));
                return db.writeQueryAsync(`match (n:CandidateProfile) where n.id in {ids} 
                    set n.hasBeenWelcomed = true return count(n)`, params);
            })
            .then(result => resolve(result.data[0]))
            .catch(err => reject(err));
    });
}

Running the following code results in a parameters argument as follows:

{"ids":["a42b470b-5e19-4fce-934c-d9a634ac21d3","7c1e3d84-389f-481c-944e-efc2f7d76dad","5b8af43a-730f-482e-b7fe-5e6fbf9e91ee","ff1c33f1-fd98-4115-84b2-3780b425cb04","48023149-b8ee-4e34-be42-a4cae5d2b41e","063fed6c-b34b-4600-a043-0112c9eb87fd","d43037d8-e490-485b-b0b3-3ffb4c5df96d","3a113529-81df-4858-a1fd-8e7b4e5354e9","0353642d-e543-45db-8fdd-061a9b660c02","a9c9c34d-9b25-4a2b-b92d-547fc8b309b1"]}

The argument looks identical to me using either es6 or bluebird promise implementation, however with es6, an error is thrown:

Neo4jError: Property values can only be of primitive types or arrays thereof
    at new Neo4jError (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/error.js:76:132)
    at newError (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/error.js:66:10)
    at Connection._handleMessage (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/internal/connector.js:355:56)
    at Dechunker.Connection._dechunker.onmessage (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/internal/connector.js:286:12)
    at Dechunker._onHeader (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/internal/chunking.js:246:14)
    at Dechunker.AWAITING_CHUNK (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/internal/chunking.js:199:21)
    at Dechunker.write (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/internal/chunking.js:257:28)
    at NodeChannel.self._ch.onmessage (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/internal/connector.js:259:27)
    at TLSSocket.<anonymous> (/Users/jblues/vampr/vend_node/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:308:16)
    at emitOne (events.js:115:13)

Not sure if this is helpful in its own right, will try to extract a public repo that demonstrates the problem asap.

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