V8-archive: Can't sort items randomly

Created on 19 Feb 2019  路  9Comments  路  Source: directus/v8-archive

I try to get 3 random items from the database. Here's the code:

client.getItems('items',{
      fields:'*.*',
      limit:3,
      sort:'?'
    })

But I get "Internal server error" as a request. Sorting by field names (even with minus in front) works great, just to mention. ;) Maybe I do simething wrong? The JS SDK docs don't show the exact filtering procedure.

bug

Most helpful comment

Thanks for reporting this @DeFUCC. I was able to reproduce it. I am going to find what the bug is and fix it on Friday.

Here is the error in the logs (without the stack trace):

[2019-02-20 16:59:02] api[_].ERROR: Error: Call to a member function isAlias() on null in /Users/welling/src/api/src/core/Directus/Database/TableGateway/RelationalTableGateway.php:1572

All 9 comments

Hmm weird. Could you try it directly on the API? /items/items?fields=*.*&limit=3&sort=?

No matter what type of API I use, i get the same "internal Server Error". Everything works well with any other sort method. Here's my browser console.

client.get('/items/words?fields=*.*&limit=3&sort=?').then(r=>console.log(r)).catch(e=>console.log(e))
Promise { <state>: "pending" }
Object { code: null, message: "Internal Server Error" }

http://etovoteto.ru/api/public/_/items/words here's the API request to try (It's currently the 7.0.17 version)

Thanks! I was trying to figure out if it was a bug in the SDK or the API 馃檪

@DeFUCC Could you check if there's anything useful logged in the /logs/ folder? That might give us a heads up of what the problem is

The logs don't show any particular errors after such calls. There are mostly expired token errors in logs.

Thanks for reporting this @DeFUCC. I was able to reproduce it. I am going to find what the bug is and fix it on Friday.

Here is the error in the logs (without the stack trace):

[2019-02-20 16:59:02] api[_].ERROR: Error: Call to a member function isAlias() on null in /Users/welling/src/api/src/core/Directus/Database/TableGateway/RelationalTableGateway.php:1572

Waiting for the v2.0.19 release. Is it coming soon?

This Monday @DeFUCC

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rijkvanzanten picture rijkvanzanten  路  3Comments

HashemKhalifa picture HashemKhalifa  路  3Comments

cdwmhcc picture cdwmhcc  路  3Comments

metalmarco picture metalmarco  路  3Comments

benhaynes picture benhaynes  路  4Comments