Unable to update metadata for the organization #301

Closed
opened 2026-03-13 07:41:15 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @Kazizodev on GitHub (Nov 29, 2024).

Describe the bug
In the organization plugin, the organization update should be able to update the metadata. However it only prompts to update the name and the slug.

To Reproduce
Steps to reproduce the behavior:

  1. Add Organization plugin from the better-auth docs
  2. Try updating the metadata from the auth client organization

Expected behavior
The update function in organization should include metadata update as well.
await organization.update({ organizationId: values.organizationId, { name: values.name, metadata: { address: values.address } } })

Desktop:

  • OS: Windows 11
  • Browser: Brave

Additional context
.

Originally created by @Kazizodev on GitHub (Nov 29, 2024). **Describe the bug** In the organization plugin, the organization update should be able to update the metadata. However it only prompts to update the name and the slug. **To Reproduce** Steps to reproduce the behavior: 1. Add Organization plugin from the better-auth docs 2. Try updating the metadata from the auth client organization **Expected behavior** The update function in organization should include metadata update as well. `await organization.update({ organizationId: values.organizationId, { name: values.name, metadata: { address: values.address } } })` **Desktop:** - OS: Windows 11 - Browser: Brave **Additional context** .
Author
Owner

@Kazizodev commented on GitHub (Nov 30, 2024):

I'm reopening this because when I update with metadata, it is stored in the database as [object object]. in string format not JSON.

It should be the same as create

const { data, error } = await organization.create({
    name: values.name,
    slug,
    metadata: { address: values.address },
})

This is saving in the database as an object { address } correctly

However in update

const { data, error } = await organization.update({
    name: values.name,
    slug,
    metadata: { address: values.address },
})

It is saving the metadata as [Object Object]

Want me to create a new issue in GitHub?

@Kazizodev commented on GitHub (Nov 30, 2024): I'm reopening this because when I update with metadata, it is stored in the database as [object object]. in string format not JSON. It should be the same as create ``` const { data, error } = await organization.create({ name: values.name, slug, metadata: { address: values.address }, }) ``` This is saving in the database as an object { address } correctly However in update ``` const { data, error } = await organization.update({ name: values.name, slug, metadata: { address: values.address }, }) ``` It is saving the metadata as [Object Object] Want me to create a new issue in GitHub?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#301