Cannot preload "object2", value of "Object1.id" is undefined #4787
Unanswered
equeraltovivas
asked this question in
Help
Replies: 1 comment
-
I'm having the same issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Package version
@adonisjs/lucid@^21.0.0
Describe the bug
Since version 21.0.0 of the @adonisjs/lucid library, an error occurs when trying to make queries with Lucid relationships. This is the error:
ERROR (18384): Cannot preload "object2", value of "Object1.id" is undefined
The relationships are correctly defined with HasManyThrough and BelongsTo, and this relationship has never failed before. (We’ve been using this setup since Adonis4, migrating to Adonis5 and now to Adonis6). Reverting to version 20.6.0 has allowed us to continue for the moment.
Here is the complete trace:
{ "type": "Exception", "message": "Cannot preload \"object2\", value of \"Object1.id\" is undefined", "stack": Exception: Cannot preload "object2", value of "Object1.id" is undefined at file:///C:/project/node_modules/@adonisjs/lucid/build/src/utils/index.js:83:15 at ensureValue (file:///C:/project/node_modules/@adonisjs/lucid/build/src/utils/index.js:31:9) at getValue (file:///C:/project/node_modules/@adonisjs/lucid/build/src/utils/index.js:82:12) at file:///C:/project/node_modules/@adonisjs/lucid/build/src/orm/relations/has_many_through/query_builder.js:59:24 at Array.map (<anonymous>) at HasManyThroughQueryBuilder.addWhereConstraints (file:///C:/project/node_modules/@adonisjs/lucid/build/src/orm/relations/has_many_through/query_builder.js:58:109) at HasManyThroughQueryBuilder.applyConstraints (file:///C:/project/node_modules/@adonisjs/lucid/build/src/orm/relations/has_many_through/query_builder.js:139:14) at HasManyThroughQueryBuilder.exec (file:///C:/project/node_modules/@adonisjs/lucid/build/src/orm/relations/base/query_builder.js:146:14) at Preloader.processRelationForMany (file:///C:/project/node_modules/@adonisjs/lucid/build/src/orm/preloader/index.js:70:57) at file:///C:/project/node_modules/@adonisjs/lucid/build/src/orm/preloader/index.js:138:25 "name": "Exception", "status": 500 }
We are working with Node version v22.2.0.
I am at your disposal if you need more information.
Reproduction repo
No response
Beta Was this translation helpful? Give feedback.
All reactions