
I'm having issues with querying User
in node-appwrite
. I've shared my codebase as well.
import { Account, Client, ID, Users } from "node-appwrite";
const APPWRITE_ENDPOINT = import.meta.env.VITE_APPWRITE_ENDPOINT;
const APPWRITE_PROJECT_ID = import.meta.env.VITE_APPWRITE_PROJECT_ID;
const APPWRITE_API_KEY = import.meta.env.VITE_APPWRITE_API_KEY;
const client = new Client()
.setEndpoint(APPWRITE_ENDPOINT)
.setProject(APPWRITE_PROJECT_ID)
.setKey(APPWRITE_API_KEY);
export async function getUserByEmail(email: string) {
const users = new Users(client);
// this is not appreciated way to filter users
const response = await users.list();
const userIndex: number = response.users.findIndex((user) => user.email === email);
// if user email is not found on Users table
if (userIndex !== -1) {
return response.users[userIndex];
} else {
return null;
}
}
export async function verifyUserEmail(email: string) {
const account = new Account(client);
await account.create(ID.unique(), email, "12345");
}
I tried to use Query
in node-appwrite
but every solutions and discussions didn't work for me.
Please let me know if someone has experienced with it.

Are you using the latest node sdk? Appwrite cloud has been upgraded to v1.5.5
and the queries are a bit different in the latest version of appwrite.

the List users endpoint accepts an array of queries that allows you to filter by email. Have you read https://appwrite.io/docs/references/cloud/server-nodejs/users#list?

I tried this but didn't work actually.
const result = await users.list([Query.equal("email", email)]);
Recommended threads
- Login without email or phone number
I'm making a web app targeted towards users who are very tech illiterate, so a lot of them won't even have emails. I know that the only two "identifiers" for a...
- Password Recovery link takes upwards of ...
Hello. I am having this issue above. Is there a way to make this faster? I created this project a while back when appwrite only supported Frankfurt servers. Wil...
- Best approach for handling users (creati...
I found out appwrite is wayy different to supabase, so i just wanted to check my approach is correct. Normally when creating user, I'd have something like a t...
