I wanted to add new post and after bad request users and posts collections have been broken. ProjectId: 65494a51aaa5cddd045f
are you still experiencing this?
And what was the request? 👀
yes
` export async function createPost(post: INewPost) { try { const uploadedFile = await uploadFile(post.file[0]);
if (!uploadedFile) throw Error;
const fileUrl = getFilePreview(uploadedFile.$id);
if (!fileUrl) {
deleteFile(uploadedFile.$id);
throw Error;
}
const tags = post.tags?.replace(/ /g, '').split(',') || [];
const newPost = await databases.createDocument(
appwriteConfig.databaseId,
appwriteConfig.postsCollectionId,
ID.unique(),
{
creator: post.userId,
caption: post.caption,
imageUrl: fileUrl,
imageId: uploadedFile.$id,
location: post.location,
tags,
}
);
if (!newPost) {
await deleteFile(uploadedFile.$id);
throw Error;
}
return newPost;
} catch (error) {
console.log(error);
}
}
export async function uploadFile(file: File) { try { const uploadedFile = await storage.createFile(appwriteConfig.storageId, ID.unique(), file);
return uploadedFile;
} catch (error) {
console.log(error);
}
}
export async function getFilePreview(fileId: string) { try { const fileUrl = storage.getFilePreview(appwriteConfig.storageId, fileId, 2000, 2000, 'top', 100); return fileUrl; } catch (error) { console.log(error); } } export async function deleteFile(fileId: string) { try { await storage.deleteFile(appwriteConfig.storageId, fileId);
return { status: 'ok' };
} catch (error) {
console.log(error);
}
} `
I wanted to create a post
and my users and posts collections are still broken
after just 1 request)
@Bogdan TvarinaDid you have users in this project?
Yes, my test accounts)
And when do you have created this project?
If it doesn't has something important, creating a new project should solve the issue
Ok, ty...
@Bogdan Tvarina does it work for you now? We had some ongoing issues
of course) just deleted project
Okay cool. Marking this one as closed. Feel free to reopen if you face it again
[CLOSED] after bad request my databases have been broken
Recommended threads
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support 👋 I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...
- Bug: TOTP MFA verification always fails ...
*Bug: TOTP MFA verify always returns `user_invalid_token` (Cloud 1.8.1, Frankfurt)** Project ID: `68dd48440003e537d849` SDK: `appwrite@18.2.0` (also tested wit...