Back
"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 {
TypeScript
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`
TL;DR
Developers encountering a server error (code 500) with a message "general_unknown" while fetching documents. The code snippet provided is attempting to retrieve documents from an Appwrite collection but seems to be facing issues. Check the query and Appwrite setup for errors.i think queries are not working
Recommended threads