"message": "Server Error", "code": 500, "type": "general_unknown", While fetching documents
- 0
- Web
i am not able to fetch documents from appwrite collection
throwing this type of error:
{
"message": "Server Error",
"code": 500,
"type": "general_unknown",
"version": "0.12.101"
}
This is the code please help
` import { Query, database } from '@/providers/AppwriteClient' import { AppwriteException } from 'appwrite'; import React from 'react'
const getUserByUserID = async (userID: string) => { try {
const response = await database.listDocuments(String(process.env.NEXT_PUBLIC_DATABASE_ID), String(process.env.NEXT_PUBLIC_COLLECTION_ID_USERS), [Query.equal('userid', userID)]);
const document = response.documents;
return {
id: document[0].$id,
userid: document[0].userid,
username: document[0].username,
email: document[0].email,
profileImage: document[0].profileImage
}
} catch (error: AppwriteException | any) {
console.error(error.message);
throw new Error(error)
}
}
export default getUserByUserID`
i think queries are not working
Recommended threads
- Cant get realtime working
Hey I nned some help with realtime a gain. I was using client.subscribe(...), and i found out that its depricated then i believe realtime.subscribe(...) is the ...
- Hi Folks, Database Writing Issue
Hey Folks im trying to get logging setup on my website but im getting an error, i dont have any document id and i think this is the issue but i havent got the f...
- Middleware
how to make middleware in nextjs appwrite with client side auth?