loopback fails with
TypeError: Cannot read property 'toString' of undefined
at KVMap.keyToString (../api_loopback/node_modules/loopback-datasource-juggler/lib/include_utils.js:64:46)
at Object.KVMap.mapImpl.set (../api_loopback/node_modules/loopback-datasource-juggler/lib/include_utils.js:70:13)
at Object.buildOneToOneIdentityMapWithOrigKeys (../api_loopback/node_modules/loopback-datasource-juggler/lib/include_utils.js:19:11)
at includeHasManySimple (../api_loopback/node_modules/loopback-datasource-juggler/lib/include.js:498:36)
at processIncludeItem (../api_loopback/node_modules/loopback-datasource-juggler/lib/include.js:275:16)
at ../api_loopback/node_modules/loopback-datasource-juggler/lib/include.js:173:5
at ../api_loopback/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:157:13
at _each (../api_loopback/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:57:9)
at Object.async.each (../api_loopback/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:156:9)
at Function.Inclusion.include (../api_loopback/node_modules/loopback-datasource-juggler/lib/include.js:172:9)
Obviously the include cannot work as i'm missing the id for relation hasMany to work, but this should be caught silently and not return the inclusion (which is actually the intent) rather than killing the server
Could easily fix this, but as there are many places to do so, i'd prefer to wait for proper guidance before submitting a fix proposal.
Eric
adding a scope in relation A>B to restrict fields in a way that 'A.id' is not included in results
I think you mean B.id is not included here right?
But anyway I reproduced it and I think a proper way to handle it is throwing an error in response body.
Thought?
Same error reported here: https://github.com/strongloop/loopback-datasource-juggler/issues/890
For the track record, same error reported here: https://github.com/strongloop/loopback/issues/3233
:+1: easy way to crash server
Most helpful comment
:+1: easy way to crash server