Back

Appwrite Functions - response from functions does not match database entry

  • 0
  • Self Hosted
  • Functions
  • Databases
Gommor
15 Sep, 2023, 19:20

Environment: Appwrite version: 1.4.2 Language/Framework: Dart (dart_appwrite plugin)

Summary: When using an Appwrite function to fetch data from the backend with the dart_appwrite plugin, the response data does not match the data that is actually stored in the Appwrite database.

Expected Behavior: The data retrieved from the Appwrite backend should exactly match the data as stored in the database, including any special characters.

Actual Behavior: The data in the response differs from the database data. The data is stored in the database as an array containing a Base64 string with special characters, but the string in the response lacks these special characters.

Steps to Reproduce: Store data in the Appwrite database as an Array["Base64 String"] with special characters. Use a Dart Appwrite function to fetch this data. Observe that the returned data lacks the special characters present in the stored data.

Whats in the database: L+alBJOsgB8nwGgtJPAoCYtbitLnHBN84dNSak12Kb+rKqetAFYxohCWF3XZ6HQ+

Whats fetched through the function: L alBJOsgB8nwGgtJPAoCYtbitLnHBN84dNSak12Kb rKqetAFYxohCWF3XZ6HQ

TL;DR
Appwrite Functions are not returning the expected data from the Appwrite database. The response from the function is missing special characters that are present in the database entry. To reproduce this issue: 1. Store data in the Appwrite database as an array with a Base64 string that includes special characters. 2. Use a Dart Appwrite function to fetch the data. 3. Notice that the fetched data is missing the special characters from the stored data. There doesn't seem to be a specific solution mentioned in the support thread.
Gommor
15 Sep, 2023, 19:42

Appwrite Functions - response from functions does not match database entry

Drake
16 Sep, 2023, 20:35

Thanks for posting this. I'll need to try and reproduce this 🧐

Gommor
19 Sep, 2023, 19:44

@Steven any update on this ?

Drake
21 Sep, 2023, 02:56

sorry i've been pretty busy. it's on my list, though!

Drake
21 Sep, 2023, 23:37

OK so I have a string array in my database like this:

Drake
21 Sep, 2023, 23:38

my code is:

TypeScript
import 'package:dart_appwrite/dart_appwrite.dart';

import 'config.dart';

var client = Client();
var databaseId;
var collectionId;
var documentId;
var userId;
var teamId;
var teamMembershipId;
var fileId;
var functionId;
var bucketId;

Future<void> main() async {
  client
      .setEndpoint(endpoint) // Make sure your endpoint is accessible
      .setProject(projectId) // Your project ID
      .setKey(key) // Your appwrite key
      // .setJWT('jwt') // Enable this to authenticate with JWT created using client SDK
      .setSelfSigned(status: true); //Do not use this in production

  final databases = Databases(client);

  final document = await databases.getDocument(
    databaseId: 'default',
    collectionId: '641496436257c85f727c',
    documentId: '650cd29729118506066a',
  );

  print(document.toMap());
}

and it prints:

TypeScript
{$id: 650cd29729118506066a, $collectionId: 641496436257c85f727c, $databaseId: default, $createdAt: 2023-09-21T23:32:39.169+00:00, $updatedAt: 2023-09-21T23:32:39.169+00:00, $permissions: [], data: {firstString: , secondString: , base64: [L+alBJOsgB8nwGgtJPAoCYtbitLnHBN84dNSak12Kb+rKqetAFYxohCWF3XZ6HQ+], $id: 650cd29729118506066a, $createdAt: 2023-09-21T23:32:39.169+00:00, $updatedAt: 2023-09-21T23:32:39.169+00:00, $permissions: [], $databaseId: default, $collectionId: 641496436257c85f727c}}

from the looks of it, I do get the +

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