Skip to content
Back

Issue with Appwrite Function Execution – 500 Error in Flutter SDK

  • 0
  • Functions
  • Cloud
Ankit Maniya
6 Jun, 2025, 01:00

Hi all, I'm encountering an issue when calling an Appwrite function from my Flutter app. Environment:

TypeScript
Appwrite Flutter SDK: 16.1.0```
**Problem:**
I'm getting the following error in the Flutter app when calling a function:
```AppwriteException: general_unknown, Server Error (500)
#0      ClientMixin.prepareResponse (package:appwrite/src/client_mixin.dart:90:9)
#1      ClientIO.call (package:appwrite/src/client_io.dart:412:14)
<asynchronous suspension>
#2      Functions.createExecution (package:appwrite/services/functions.dart:63:17)
<asynchronous suspension>
#3      DbBackendClient.sendByteData.<anonymous closure> (package:port_db_backend_client/db/db_client_flutter.dart:307:7)
<asynchronous suspension>
#4      DbBackendClient.sendByteData (package:port_db_backend_client/db/db_client_flutter.dart:296:5)
<asynchronous suspension>
#5      PortDbBackendClient._sendData.<anonymous closure> (package:port_db_backend_client/src/port_db_backend_client_base.dart:93:39)
<asynchronous suspension>

Notes: The function execution appears successful in the Appwrite Console, and I can even see the correct response there. But from the Flutter app, it throws a general_unknown (500) error.

Question: Am I missing something in the response handling, or is this a known issue with the Flutter SDK? Any ideas on how to debug or fix this?

Thanks in advance 🙏

TL;DR
Developers encountering a 500 error when calling an Appwrite function from a Flutter app. The function execution is successful in the Appwrite Console, but the Flutter app receives a general_unknown error. This could be a response handling issue or a known problem with the Flutter SDK. To debug, check the response handling code and ensure proper error handling.
Ankit Maniya
6 Jun, 2025, 01:02

My Flutter code

TypeScript
    // and return the response in byte data
    // execute for '/kmsgx' in backend cloud function
    await _functions
        .createExecution(
      functionId: _functionId,
      headers: {
        'Content-Type': 'application/octet-stream',
      },
      path: '/kmsgx',
      method: ExecutionMethod.pOST,
      body: String.fromCharCodes(byteData),
    )
        .then(
      (Execution execution) {
        print('Function executed successfully: ${execution.responseBody}');
        // if it is not UnAuthorized response then responseData with byte data
        if (!execution.responseBody.contains('UnAuthorized')) {
          // codeUnits will return the LIST<int> data
          responseData = Uint8List.fromList(execution.responseBody.codeUnits);
        }
      },
    ).onError((error, stackTrace) {
      print("error, stackTrace :: \n$error, \n $stackTrace");
    });```
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