{ "message": "Invalid query: {method:equal,attribute:accountId,values:[660277c0b25c8e105e95]}", "code": 400, "type": "general_query_invalid", "version": "0.12.128" } this is my code export async function getCurrentUser() { try { const currentAccount = await getActiveSession();
TypeScript
if (!currentAccount) throw new Error("error getting currentAccount");
console.log(currentAccount, currentAccount.$id);
const currentUser = await database.listDocuments(Databaseid, userid, [
Query.equal("accountId", currentAccount.$id),
]);
console.log(currentUser);
if (!currentUser) throw new Error("error getting current user");
return currentUser.documents[0];
} catch (err) { console.log(err); } }
TL;DR
Appwrite query not functioning due to an invalid query error. The code is attempting to retrieve a user based on their accountId, but the query structure is incorrect. The error message "Invalid query" with code 400 is appearing. To solve this, modify the query structure to be valid and ensure it matches the database structure.Recommended threads
- Project paused?
Hello, I have two Appwrite projects and I can not resume them for some reason. I'm using the free plan, and I saw in the pricing page that 2 free projects are a...
- Help
- HUGE OUTRAGE IN APPWRITE, I CANNOT ACCES...
I have 2k users trying to access, sending me messages. What am I supposed to do? Please solve this asap.