Skip to content
Back

Update User Error

  • 0
  • Auth
  • Web
  • Cloud
IamtheFuture
14 Dec, 2024, 13:31
TypeScript
const { users, databases } = await createAdminClient();

const session = await getLoggedInUser();

const user = await users.get(session.$id);
    if (!user) {
      throw new Error("User not found");
    }

    await users.updateEmail(user.$id, email);
    await users.updateName(user.$id, first_name + " " + last_name);

    if (phone) {
      await users.updatePhone(user.$id, phone);
    }

it throwing ⨯ AppwriteException: A target with the same ID already exists. at async updateProfile (account/action.ts:32:9)

TL;DR
Error message "A target with the same ID already exists" is thrown when updating user information due to a conflict. Possible solution: Check for duplicate IDs in the update process to prevent errors.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more