Synchronous Function Execution Timed Out (408) on Appwrite Cloud – Dart Function
- 0
- 1
- Flutter
- Functions
- Cloud
Hi Appwrite team 👋
I’m facing a synchronous function execution timeout issue on Appwrite Cloud and would appreciate some guidance.
I executed this function using flutter appwrite sdk: appwrite: 17.0.1
Error Message:
Error Code: 408```
```Function Details:
Runtime: Dart (dart-3.5)
Function Type: HTTP-triggered
Method: POST
Plan: Free plan (Appwrite Cloud)
Resources:
CPU: 0.5
Memory: 512 MB
Configured Timeout: 15 seconds
Execution Info:
Status Code: 500
Status: Failed
Triggered By: HTTP
Actual Duration: ~30 seconds```
How I executed function from Flutter Application
@override
Future<Uint8List?> sendByteData(Uint8List byteData) async {
Uint8List? responseData;
// Execute the function with the provided byte data
// and return the response as byte data.
//
// To send base64-encoded data:
// - Set Content-Type to 'text/plain'
// - Use path: '/xxx?type=base64'
// - Use body: base64Encode(byteData)
//
// To send binary data:
// - Set Content-Type to 'application/octet-stream'
// - Use path: '/xxx'
// - Use body: String.fromCharCodes(byteData)
await _functions
.createExecution(
functionId: _functionId,
headers: {
'Content-Type':
'text/plain', // Use 'application/octet-stream' for binary data
},
path: '/xxx?type=base64', // Use '/xxx' for binary data
method: ExecutionMethod.pOST,
body: base64Encode(
byteData), // Use String.fromCharCodes(byteData) for binary data
)
.then(
(Execution execution) {
// print('Execution MAP: => ${execution.toMap()}\n');
print('[PORT-XXX] Function executed successfully: ${execution.responseBody}\n');
// if it is not UnAuthorized response then responseData with byte data
if (!execution.responseBody.contains('UnAuthorized')) {
// When sending base64 data, the response is also base64-encoded
responseData = base64Decode(execution.responseBody);
}
},
).onError((error, stackTrace) {
throw "$error";
});
return responseData;
}
Error logs from my flutter app
I/flutter (21687): error, stackTrace ::
I/flutter (21687): AppwriteException: function_synchronous_timeout, Synchronous function execution timed out. Use asynchronous execution instead, or ensure the execution duration doesn't exceed 30 seconds. (408),
I/flutter (21687): #0 ClientMixin.prepareResponse (package:appwrite/src/client_mixin.dart:90:9)
client_mixin.dart:90
I/flutter (21687): #1 ClientIO.call (package:appwrite/src/client_io.dart:415:14)
client_io.dart:415
I/flutter (21687): <asynchronous suspension>
I/flutter (21687): #2 Functions.createExecution (package:appwrite/services/functions.dart:63:17)
functions.dart:63
I/flutter (21687): <asynchronous suspension>
I/flutter (21687): #3 DbBackendClient.sendByteData.<anonymous closure> (package:port_db_backend_client/db/db_client_flutter.dart:326:7)
db_client_flutter.dart:326
I/flutter (21687): <asynchronous suspension>
I/flutter (21687): #4 DbBackendClient.sendByteData (package:port_db_backend_client/db/db_client_flutter.dart:313:5)
db_client_flutter.dart:313
I/flutter (21687): <asynchronous suspension>
I/flutter (21687): #5 PortDbBackendClient.transportStatus.<anonymous closure> (package:port_db_backend_client/src/port_db_backend_client_base.dart:142:19)
port_db_backend_client_base.dart:142
I/flutter (21687): <asynchronous suspension>
I/flutter (21687): #6
Here is the Screen Shots
Recommended threads
- Appwrite Cloud project is paused and nev...
Hi Appwrite Team & Community, I am facing a problem with one of my Appwrite Cloud projects which seems to be identical to the other cases of "paused projects" ...
- Timed out waiting for runtime error
execution id 6a3e0791978712d81ee0 im having issue with appwrite function runtime performance. even after 4gbram and cpu same function sometimes completes in a...
- Project auto-blocked after load testing ...
Hi team 👋 My project has been automatically blocked with the message: "Project is currently blocked — Access to this project is restricted. Contact support if...