Back
Error: AppwriteException: Collection with the requested ID could not be found
- 0
- Self Hosted
- Web
Stefan
TypeScript
import { ID, Query } from "appwrite";
import { databases } from "$lib/appwrite";
import type { FormState } from "$lib/configs/CompanyForm";
const DATABASES_ID = import.meta.env.VITE_APPWRITE_DATABASES_ID;
const COLLECTION_ID = "steps";
const createFormService = () => {
async function getFormStore(email: string) {
try {
const response = await databases.listDocuments(DATABASES_ID, COLLECTION_ID, [
Query.equal("email", email)
]);
// if fetched formStore exists
if (response.total > 0) {
return response.documents[0];
} else {
return null;
}
} catch (error: any) {
throw new Error(error);
}
}
async function updateFormStore(formStore: FormState) {
const exist = await getFormStore(formStore.user.email);
if (exist) {
await databases.updateDocument(DATABASES_ID, COLLECTION_ID, exist.$id, formStore);
} else {
await databases.createDocument(DATABASES_ID, COLLECTION_ID, ID.unique(), formStore);
}
}
return {
getFormStore,
updateFormStore
};
};
const formService = createFormService();
export default formService;
This time, I got this error when I call updateFormStore
method
Error: AppwriteException: Collection with the requested ID could not be found.
TL;DR
There is an error "AppwriteException: Collection with the requested ID could not be found" when calling the `updateFormStore` method.
To check the permissions on the collection and verify its existence, ensure that the `COLLECTION_ID` variable is correctly set to "steps" and that the database ID is being fetched correctly. Also, ensure the proper authorization and collection settings in the Appwrite console.
**Solution:** Double-check that the `COLLECTION_ID` is correct and verify permissions in the Appwrite console to ensure the collection is accessible. Steven
What are the permissions on the collection?
Stefan
How do I check that?
Recommended threads
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- Custom emails
What happen if I use a third party email provider to customize my emails and my plan run out of emails/month? Appwrite emails are used as fallback sending emai...
- Realtime with multiple connections
I need the Realtime on multiple Collections for diffrent applicational logic. So my question is: Is there a way to have only 1 Websocket connection or do I need...