Back

Invalid relationship value. Must be either a document ID or a document, array given.

  • 0
  • Self Hosted
  • Functions
  • Databases
  • Flutter
Spiele
26 May, 2024, 15:57

Since updating to 1.5.6 and 1.5.7 I'm getting this error: Invalid relationship value. Must be either a document ID or a document, array given. I've downgraded back to 1.5.5, where it's working again.

It's a simple dart function which creates a new document with a relationship:

TypeScript
final docId = ID.unique();
await databases.createDocument(
  databaseId: 'exampleDbId',
  collectionId: 'exampleCollectionId',
  documentId: docId,
  data: {
    'title': 'Example',
    'nestedDocs': [
       {
          "\$id": docId,
          "array": [],
       },
    ]
  },
);

Stacktrace:

TypeScript
Error: Invalid relationship value. Must be either a document ID or a document, array given.
#0      ClientMixin.prepareResponse (package:dart_appwrite/src/client_mixin.dart:73)
#1      ClientIO.call (package:dart_appwrite/src/client_io.dart:249)
<asynchronous suspension>
#2      Databases.createDocument (package:dart_appwrite/services/databases.dart:1060)

appwrite: ^12.0.3 dart_appwrite: ^11.0.2

TL;DR
Developers are encountering an "Invalid relationship value" error after updating to versions 1.5.6 and 1.5.7 of the appwrite package. Downgrading to version 1.5.5 resolves the issue. The error occurs when attempting to create a document with a relationship using the createDocument function. The issue may be fixed in future releases of the package. (Versions used: appwrite ^12.0.3, dart_appwrite ^11.0.2)
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