Sorry for bothering you everyone but I am getting this error
This is my post form relevant part `else { const file = data.image ? appwriteService.uploadFile(data.image[0]) : <Loading />; try { if (file) { const fileId = file.$id data.blogImage = fileId const dbPost = await appwriteService.createPost({ ...data, userId: userData.$id})
if (dbPost) {
navigate('/profile')
}
}
} catch (error) {
console.log(`ERROR POSTING `, error)
}
}`
This is appwrite services `import {Client, ID, Databases, Storage, Query } from 'appwrite'; import conf from '../conf/conf'
export class AppwriteService{ client = new Client(); databases; storage;
constructor () {
this.client
.setEndpoint(conf.appwriteUrl)
.setProject(conf.appwriteProjectId)
this.databases = new Databases(this.client);
this.storage = new Storage(this.client);
}
async createPost ({title, content, blogImage, userId}) {
try {
await this.databases.createDocument(
conf.appwriteDatabaseId,
conf.appwriteArticleCollectionId,
userId,
{
title,
content,
blogImage,
}
)
} catch (error) {
console.log("Backend :: createPost :: error", error)
throw error
}
}`
Please help
Backend :: createPost :: error AppwriteException: Invalid document structure: Missing required attribute "blogImage" at Client.<anonymous> (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=de89454e:850:17) at Generator.next (<anonymous>) at fulfilled (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=de89454e:488:24) PostForm.jsx:52
ERROR POSTING AppwriteException: Invalid document structure: Missing required attribute "blogImage" at Client.<anonymous> (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=de89454e:850:17) at Generator.next (<anonymous>) at fulfilled (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=de89454e:488:24)
this is the error
I am using reactJs
Recommended threads
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...