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

🐛 Bug Report: Server Error using Query.limit without Query.cursorAfter/Query.cursorBefore #8419

Closed
2 tasks done
hej2010 opened this issue Jul 19, 2024 · 5 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@hej2010
Copy link

hej2010 commented Jul 19, 2024

👟 Reproduction steps

Querying with listDocuments e.g.:

const docs = await databases.listDocuments(
   database,
   collection,
   [
      Query.equal("key", "value"),
      Query.limit(5)
   ]
);

👍 Expected behavior

The query returns at most 5 documents

👎 Actual Behavior

Function execution fails with Server Error, general_unknown

Full error:
{"code":500,"type":"general_unknown","response":{"message":"Server Error","code":500,"type":"general_unknown","version":"1.5.7","file":"/usr/src/code/vendor/utopia-php/database/src/Database/Database.php","line":2621,"trace":[{"file":"/usr/src/code/app/controllers/api/databases.php","line":3011,"function":"getDocument","class":"Utopia\\Database\\Database","type":"->","args":["database_1_collection_8",null]},{"file":"/usr/src/code/vendor/utopia-php/database/src/Database/Validator/Authorization.php","line":166,"function":"{closure}","args":[]},{"file":"/usr/src/code/app/controllers/api/databases.php","line":3011,"function":"skip","class":"Utopia\\Database\\Validator\\Authorization","type":"::","args":[{}]},{"file":"/usr/src/code/vendor/utopia-php/framework/src/App.php","line":531,"function":"{closure}","args":["database","collection",[{},{},{},{}],{},{},"default"]},{"file":"/usr/src/code/vendor/utopia-php/framework/src/App.php","line":705,"function":"execute","class":"Utopia\\App","type":"->","args":[{},{},{}]},{"file":"/usr/src/code/app/http.php","line":257,"function":"run","class":"Utopia\\App","type":"->","args":[{},{}]}]}}

Docker logs:

[Error] Method: GET
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents
[Error] Type: TypeError
[Error] Message: Utopia\Database\Database::getDocument(): Argument #2 ($id) must be of type string, null given, called in /usr/src/code/app/controllers/api/databases.php on line 3011
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
[Error] Line: 2621

Added all necessary indexes but it only works if I remove Query.limit or add Query.cursorAfter/Query.cursorBefore.

🎲 Appwrite version

Version 1.5.x

💻 Operating system

Linux

🧱 Your Environment

Appwrite 1.5.7, default Docker setup, node-18.0 runtime.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@hej2010 hej2010 added the bug Something isn't working label Jul 19, 2024
@byawitz
Copy link
Member

byawitz commented Jul 19, 2024

Hi @hej2010 thanks for the issue

What version of node-appwrite you're using?

@hej2010
Copy link
Author

hej2010 commented Jul 19, 2024

Edit: nevermind, it's on 12.0.1

@hej2010
Copy link
Author

hej2010 commented Jul 19, 2024

Updated to 13.0.0 but it also fails

@byawitz
Copy link
Member

byawitz commented Jul 19, 2024

How many document you have on that collection?

@hej2010
Copy link
Author

hej2010 commented Jul 20, 2024

Was a code bug on my end, it has been fixed now :) Was not an issue with Appwrite

@hej2010 hej2010 closed this as completed Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants