Organization update error

I have been trying to update organization but it giving Invalid body parameters , I added additional fields to it as well. It's in the link below the code https://pastebin.com/Xr3EWhcV @ping @FalconiZzare
Pastebin
Auth Setup - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
5 Replies
FalconiZzare
FalconiZzare2mo ago
Please do show how you are making the API call from the client and full error message
Hunter
HunterOP2mo ago
const onSubmit = async (data) => { // console.log("SUBMITTING DATA", data); const { name, slug, logo, banner, phoneNumber, businessName, // email, website, description, country, address, state, region, zipCode, city, status, storeTag, whitelabel, facebook, instagram, tiktok, twitter, linkedin, currency, storeUrl, businessCategory, } = data; await authClient.organization.update( { data: { name, logo, slug, businessName, businessCategory, banner, phoneNumber, // email, website, description, country, address, state, region, zipCode, city, status, storeTag, whitelabel, facebook, instagram, tiktok, twitter, linkedin, currency, storeUrl, }, organizationId: storeId, //defaults to the current active organization }, { onSuccess(ctx) { toast.success("Store updated successfully"); }, }, { onError(ctx) { toast.error("Failed to update store"); }, } ); }; const updateStoreSchema = z.object({ name: z.string().min(0).optional().nullable(), slug: z.string().min(0).optional().nullable(), logo: z.any().optional(), businessName: z.string().min(0).optional().nullable(), businessCategory: z.string().optional().nullable(), banner: z.string().min(0).optional().nullable(), phoneNumber: z.string().min(0).optional().nullable(), // email: z // .string("Invalid email or wrong email") // .min(0) // .optional() // .nullable(), website: z.string().min(0).optional().nullable(), description: z.string().min(0).optional().nullable(), country: z.string().min(0).optional().nullable(), address: z.string().min(0).optional().nullable(), state: z.string().min(0).optional().nullable(), region: z.string().min(0).optional().nullable(), zipCode: z.string().min(0).optional().nullable(), city: z.string().min(0).optional().nullable(), status: z.string().min(0).optional().nullable(), storeTag: z.string().min(0).optional().nullable(), whitelabel: z.string().min(0).optional().nullable(), facebook: z.string().min(0).optional().nullable(), instagram: z.string().min(0).optional().nullable(), tiktok: z.string().min(0).optional().nullable(), twitter: z.string().min(0).optional().nullable(), linkedin: z.string().min(0).optional().nullable(), currency: z.string().min(0).optional().nullable(), storeUrl: z.string().min(0).optional().nullable(), }); const { register, handleSubmit, control, formState: { errors, isSubmitting }, } = useForm({ resolver: zodResolver(updateStoreSchema), defaultValues: { name: activeOrganization?.name, slug: activeOrganization?.slug, .......: @FalconiZzare @Ping any help here
FalconiZzare
FalconiZzare2mo ago
Hey, sorry, I didn't notice the reply. From your message it's really hard to understand the issue. So I need a github repository to that can reproduce the issue.
Hunter
HunterOP2mo ago
I have not saved it to github , but I can try an explain it. First I added additional fields to the organization table I used the inferorg and additional fields plugin, I have react client and express backend. I can create the organization successfully but when i try to update it it gives me invalid body parameters . https://pastebin.com/Xr3EWhcV. Auth config is in there, I don't know if I am omitting something from it. The update org code is also up there in the chat , maybe I have done a mistake in there or something
FalconiZzare
FalconiZzare2mo ago
I mean i need to try the code myself to find the issue. I will check the auth config. allow me some time Which database and database adapter are you using?

Did you find this page helpful?