Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.has() and .whereHas() not work anymore #294

Closed
lhmboyz opened this issue Feb 9, 2018 · 1 comment
Closed

.has() and .whereHas() not work anymore #294

lhmboyz opened this issue Feb 9, 2018 · 1 comment
Assignees

Comments

@lhmboyz
Copy link

lhmboyz commented Feb 9, 2018

Hi friend,

Can you help me?

After some update of adonis framework and its library, suddenly I received this error when i use .has() or .whereHas() on all my route. It's worked before.

This is the example code:

let accounts = await Account.query()
            .with('account_subclassification')
            .has('account_subclassification')
            .fetch()

or

let accounts = await Account.query()
            .with('account_subclassification')
            .whereHas('account_subclassification', (builder) => {
                builder.where('name', 'Kas')
            })
            .fetch()

without .has() and .whereHas(), it worked normally.

And here are the complete error messages:

TypeError: Cannot read property 'queryContext' of undefined
1
at Formatter.wrapAsIdentifier (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\knex\lib\formatter.js line 147 col 37)
2
at Formatter.wrapString (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\knex\lib\formatter.js line 246 col 27)
3
at Formatter.wrap (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\knex\lib\formatter.js line 142 col 21)
4
at Formatter.wrapString (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\knex\lib\formatter.js line 244 col 27)
5
at Formatter.wrap (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\knex\lib\formatter.js line 142 col 21)
6
at Formatter.columnize (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\knex\lib\formatter.js line 57 col 19)
7
at Proxy.columnize (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\@adonisjs\lucid\src\Lucid\Relations\BaseRelation.js line 245 col 42)
8
at Proxy.relatedWhere (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\@adonisjs\lucid\src\Lucid\Relations\BelongsTo.js line 125 col 22)
9
at Proxy._has (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\@adonisjs\lucid\src\Lucid\QueryBuilder\index.js line 177 col 43)
10
at Proxy.whereHas (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\@adonisjs\lucid\src\Lucid\QueryBuilder\index.js line 714 col 12)
11
at LucidTestingController.index (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\app\Controllers\Http\Testing\LucidTestingController.js line 19 col 14)
12
at Server._routeHandler (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\@adonisjs\framework\src\Server\index.js line 326 col 31)
13
at Server._resolveMiddleware (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\@adonisjs\framework\src\Server\index.js line 216 col 28)
14
at Runnable._invoke (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\co-compose\src\Runnable.js line 76 col 42)
15
at once (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\co-compose\src\Runnable.js line 73 col 34)
16
at f (D:\Workspace\pusatdagangutama\api.pusatdagangutama.com\node_modules\once\once.js line 25 col 25)


@lhmboyz
Copy link
Author

lhmboyz commented Feb 9, 2018

Hi friend,

I think i found what caused the issue.

It's the dependency of adonis-lucid => knex

Knex version 0.14.3 is causing the issue here, it's doing fine with 0.14.2 version of knex.

@thetutlage thetutlage self-assigned this Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants