neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

Trying to update entity without arguments provided is throwing error Cannot set property 'id' of undefined

Open Stradivario opened this issue 6 years ago • 2 comments

Expected: When trying to update from default CRUD operations only by adding id:1 without second arguments should not throw error

mutation UpdateAppType {
  UpdateAppType(id: 1) {
    id
  }
}

Result:



TypeError: Cannot set property 'id' of undefined
    at nodeUpdate (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/neo4j-graphql-js/dist/translate.js:709:44)
    at translateMutation (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/neo4j-graphql-js/dist/translate.js:547:12)
    at cypherMutation (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/neo4j-graphql-js/dist/index.js:164:43)
    at _callee$ (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/neo4j-graphql-js/dist/index.js:45:31)
    at tryCatch (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
    at new Promise (<anonymous>)
    at new F (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/core-js/library/modules/_export.js:36:28)
    at /home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12
    at neo4jgraphql (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/neo4j-graphql-js/dist/index.js:102:17)
    at acc.(anonymous function) (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/neo4j-graphql-js/dist/augment.js:307:36)
    at /home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/graphql-tools/src/makeExecutableSchema.ts:102:20
    at resolveFieldValueOrError (/home/rampage/Desktop/work/repos/private/gapi-starter-simple/node_modules/graphql/execution/execute.js:479:18)

Resolution:

Adding second parameters name and email required by the schema is working properly

mutation UpdateAppType {
  UpdateAppType(id: 1, email:"dada", name:"dada") {
    id
  }
}

Stradivario avatar Feb 24 '19 02:02 Stradivario

Example: https://github.com/Stradivario/gapi-starter-neo4j

Stradivario avatar Feb 24 '19 04:02 Stradivario

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608

michaeldgraham avatar May 02 '21 04:05 michaeldgraham