Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Can't sort items randomly #787

Closed
davay42 opened this issue Feb 19, 2019 · 9 comments
Closed

Can't sort items randomly #787

davay42 opened this issue Feb 19, 2019 · 9 comments
Labels
bug Something isn't working

Comments

@davay42
Copy link

davay42 commented Feb 19, 2019

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.

@rijkvanzanten
Copy link
Member

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

@davay42
Copy link
Author

davay42 commented Feb 19, 2019

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" }

@davay42
Copy link
Author

davay42 commented Feb 19, 2019

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

@rijkvanzanten
Copy link
Member

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

@rijkvanzanten rijkvanzanten transferred this issue from another repository Feb 19, 2019
@rijkvanzanten
Copy link
Member

@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

@davay42
Copy link
Author

davay42 commented Feb 19, 2019

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

@wellingguzman
Copy link
Contributor

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

@benhaynes benhaynes added the bug Something isn't working label Feb 21, 2019
@davay42
Copy link
Author

davay42 commented Mar 7, 2019

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

@rijkvanzanten
Copy link
Member

This Monday @DeFUCC

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants