Skip to content
Back

Server Error when upserting existing and non existing documents

  • 0
  • Databases
  • Web
  • Self Hosted
Zaryuu
12 Sep, 2025, 09:30

Hello there! Im currently experiencing issues with the not so long ago officially announced upserting funcionality. Im running appwrite 1.7.4 self hosted and node-appwrite 17.2.0 on nextjs15. Everytime i want to use the upserting function, im getting the 500 general_unknown error. This happens if neither document exists or not. Even with a dummy table and dummy data it wont work (code below)

TypeScript
export async function testUpsert() {
  try {
    const { databases } = await createSessionClient();
    await databases.upsertDocument(APPWRITE_DATABASE, "test", "test-id", {
      test: "test",
    });
    return { success: true, message: "test_complete" };
  } catch (error: any) {
    return { success: false, message: error.code.toString() };
  }
}

And that's the console output from the backend container, when upsert the test document

TypeScript
[Error] Timestamp: 2025-09-12T10:06:01+00:00
[Error] Method: PUT
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: TypeError
[Error] Message: array_unique(): Argument #1 ($array) must be of type array, null given
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Document.php
[Error] Line: 85

Creating and updating data, via their designated functions works fine tough. Ive seen another thread where someone experiencied this issue, but he was using the cloud saas version of appwrite.

Is this issue about to be fixed and maybe released soon?

Would be nice if someone knows, if im making something wrong or if this issue is about to be fixed in the near future.

Thanks a lot in advance!

TL;DR
Upsert feature not available in versions prior to 1.8.0, must wait for release or use cloud service as a workaround. User curious about conflicting information in documentation.
ideclon
12 Sep, 2025, 17:18

I believe upsert was only added in v1.8.

Zaryuu
12 Sep, 2025, 17:54

Hmm okay, i thought it maybe would be in 1.7.4, as upsert is in the 17.2.0 sdk

D5
12 Sep, 2025, 22:24

Unfortunately not. You need to wait for the 1.8.0 release or use cloud for now 😅

Zaryuu
13 Sep, 2025, 06:27

Well i have a workaround so, i probably just wait, but thank you all!

whataboutno13
9 Feb, 2026, 15:54

Quick question regarding upserting only working in 1.8.x. The documentation says it works with 1.7.x, so what information is actually valid? 😅

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