Back

[SOLVED] AppwriteException: Invalid query: {"method":"limit","values":[15]}

  • 1
  • Databases
  • Web
  • Cloud
Ajmal Jalal
26 Mar, 2024, 05:32

I upgraded my Next.js version to 14 and now I am getting this error when calling listDocuments on a collection. Any idea? hear is the code:

TypeScript
  let response = await db.listDocuments(
    process.env.NEXT_PUBLIC_APPWRITE_DATABASE_ID as string,
    collections.posts,
    [
      Query.limit(limit),
      Query.offset((page - 1) * limit),
      Query.orderDesc('$createdAt'),
      Query.isNull('parent')

    ]
  );
  return response.documents;
}```
TL;DR
Developers were experiencing an "Invalid query" error with the Appwrite SDK. The solution is to use Appwrite version 13.0.2 instead of a different version. Users were advised to check the versions they are currently using, as updating the SDKs may cause issues. Additionally, they were recommended to log values before making requests and ensure that the value passed to the limit method is a number.
webothdo
26 Mar, 2024, 06:37

check the value you're passing to the limit method and make sure it's a number

webothdo
26 Mar, 2024, 06:38

you might want to log it to the console before making any requests

Ajmal Jalal
26 Mar, 2024, 18:04

it is a number, even if I comment out the limit it will throw that error with other Queries

Ajmal Jalal
26 Mar, 2024, 18:05

the same code was working yestarday

Kenny
26 Mar, 2024, 18:11

Did you accidentally update appwrite or node-appwrite SDKs

Kenny
26 Mar, 2024, 18:11

Could you provide what versions youve got?

Ajmal Jalal
26 Mar, 2024, 18:14

I have "appwrite": "^14.0.0"

Kenny
26 Mar, 2024, 18:58

You'll need to use appwrite 13.0.2, npm install appwrite@13.0.2, if you look at the top of the packages page on NPM you'll see in bold letters, it says that is only valid for Appwrite 1.5.x.

Ajmal Jalal
26 Mar, 2024, 18:59
Ajmal Jalal
26 Mar, 2024, 18:59

Thank you

Kenny
26 Mar, 2024, 19:00

[SOLVED] AppwriteException: Invalid query: {"method":"limit","values":[15]}

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more