neo4j / neo4j-javascript-driver

Neo4j Bolt driver for JavaScript
https://neo4j.com/docs/javascript-manual/current/
Apache License 2.0
853 stars 148 forks source link

ypeError: Cannot read properties of undefined (reading 'startsWith') #1118

Closed beraujjwal closed 11 months ago

beraujjwal commented 1 year ago

Bug Report

I am facing this error ` TypeError: Cannot read properties of undefined (reading 'startsWith')

at captureStacktrace (/app/node_modules/neo4j-driver-core/lib/result.js:611:17)
at new Result (/app/node_modules/neo4j-driver-core/lib/result.js:105:23)
at Session._run (/app/node_modules/neo4j-driver-core/lib/session.js:229:16)
at Session.run (/app/node_modules/neo4j-driver-core/lib/session.js:179:27)
at Object.write (/app/app/helpers/neo4j.js:49:28)

` Here is my helper code

try { const session = driver.session({ database, defaultAccessMode: neo4j.session.WRITE }); return session.run(cypher, params).then(result => { console.log(result); result.records.forEach(record => { console.log(record) }); return result.records; }).catch(err => { console.log(err); throw new Error(err.message); }).finally(() => { session.close(); }); } catch (err) { throw new Error(err.message); }

Cypher Code

` CREATE (u:User { uuid: $_id, name: $name, phone: $phone, email: $email, password: $password, tokenSalt: $tokenSalt, isEmailVerified: $isEmailVerified, isPhoneVerified: $isPhoneVerified, deleted: $deleted, status: $status, verified: $verified, deletedAt: $deletedAt, blockExpires: $blockExpires, createdAt: $createdAt, updatedAt: $updatedAt })

WITH u, $roles AS roles

MATCH (r:Role) WHERE r.uuid in roles CREATE (u)-[:HAS_ROLE]->(r)

RETURN u `

Params

` { isEmailVerified: false, isPhoneVerified: false, verified: true, roles: [ 'a48cde8a-efea-4a1f-9c9e-53b8d48a5b3f' ], loginAttempts: 0, deviceId: null, deviceType: null, fcmToken: null, deleted: false, status: true, name: '** ', email: '**@gmail.com', phone: '##########', password: '**', blockExpires: '2023-07-29T01:59:40.283Z', rights: [], _id: '17ce0fd7-b0c4-4117-8d73-0a0a8af8a1a0' }

`

bigmontz commented 1 year ago

@beraujjwal, thanks for reporting. Could you please inform the driver and neo4j versions?

I executed your sample locally and get a different error:

Neo4jError: Expected parameter(s): tokenSalt, deletedAt, createdAt, updatedAt
  constructor: [Function: Neo4jError] { isRetriable: [Function (anonymous)] },
  code: 'Neo.ClientError.Statement.ParameterMissing',
  retriable: false
}
bigmontz commented 11 months ago

Closing issue due inactivity. You can open the issue whenever you have new evidences.