Query method not valid #5804
-
💭 Description
const { Client, Databases, ID, Query } = require('appwrite');
const client = new Client().setEndpoint('https://cloud.appwrite.io/v1').setProject('64ad1e3103fde8825ab8');
const databases = new Databases(client);
const promise = databases.listDocuments('64ad1e91ce62e8e6297f', '64ad1eb651ec1c154276', [
/* I want to get data with 'name' attribute and user read permission status is on */
Query.select(['name'])
]);
promise.then(
function (response) {
console.log(response);
},
function (error) {
console.log(error);
}
);
AppwriteException: Query method not valid: select
at Client.<anonymous> (C:\Users\myuser\Desktop\myapp\node_modules\appwrite\dist\cjs\sdk.js:393:27)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\myuser\Desktop\myapp\node_modules\appwrite\dist\cjs\sdk.js:24:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 400,
type: 'general_argument_invalid',
response: {
message: 'Query method not valid: select',
code: 400,
type: 'general_argument_invalid',
version: '0.10.45'
}
} 👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
|
Beta Was this translation helpful? Give feedback.
Answered by
stnguyen90
Jul 12, 2023
Replies: 1 comment 1 reply
-
@hthuantj, thanks for raising this! 🙏🏼 The SDK you're using is meant for Appwrite 1.3.x, but you seem to be connecting to Appwrite Cloud, which is on 1.1.2. That's why Appwrite is rejecting your request with the error mentioned. For Appwrite Cloud, you should use version 10.1.0 of the appwrite NPM package. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@hthuantj, thanks for raising this! 🙏🏼
The SDK you're using is meant for Appwrite 1.3.x, but you seem to be connecting to Appwrite Cloud, which is on 1.1.2. That's why Appwrite is rejecting your request with the error mentioned. For Appwrite Cloud, you should use version 10.1.0 of the appwrite NPM package.