the server respond with status 500. i am trying to post cant go through at appwrite cloud
please provide more detail
you can please have a look at the screenshot
please share your code, request payload, and project id
VITE_APPWRITE_PROJECT_ID='6581d9959beb7f0151cb'
which part of the cord should i share
i also dnt know how to get the payload. i am in the learning process
import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import * as z from "zod" import { useNavigate } from "react-router-dom";
import { Button } from "@/components/ui/button" import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from "@/components/ui/form" import { Input } from "@/components/ui/input" import { Textarea } from "../ui/textarea" import FileUploader from "../shared/FileUploader" import { PostValidation } from "@/lib/validation" import { Models } from "appwrite" import { useUserContext } from "@/context/AuthContext" import { useToast } from "../ui/use-toast" import { useCreatePost } from "@/lib/react-query/queriesAndMutations";
type PostFormProps = { post?: Models.Document; }
const PostForm = ({ post }: PostFormProps) => { const { mutateAsync: createPost, isPending: isLoadingCreate } = useCreatePost(); const { user } = useUserContext(); const { toast } = useToast(); const navigate = useNavigate();
// 1. Define your form schema.
const form = useForm<z.infer<typeof PostValidation>>({ resolver: zodResolver(PostValidation), defaultValues: { caption: post ? post?.caption : "", file: [], location: post ? post?.location : "", tags: post ? post.tags.join(',') : "" }, })
// 2. Define a submit handler. async function onSubmit(values: z.infer<typeof PostValidation>) { const newPost = await createPost({ ...values, userId: user.id, }) if(!newPost) { toast({ title: 'Please try again' }) } navigate('/');
that the post form
FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.
your browser dev tools has network logs. you can look through that for your request
file is not a valid attribute in your collection
Recommended threads
- Error getting preview of file
Rest Response: ``` { "message": "Server Error", "code": 500, "type": "general_unknown", "version": "1.8.1" } ``` Appwrite Logs ``` appwrite ...
- Storage images using custom domain retur...
Some of the images uploaded to my storage bucket returns this error: ``` { "message": "Project with the requested ID could not be found. Please check the value...
- Bandwidth limit for your organization ha...
I received an alert that I exceeded the Free plan bandwidth limit (showing 5.86 GB), but my dashboard tells a different story. The usage stats there are much lo...