Hello guys,
I run an execution Execution execution = await functions.getExecution(
functionId: functionId, executionId: executionId);
which call the Completation Chat API from OpenAI.
Since it took more than 30 seconds and I got the error Operation timed out after 30000 milliseconds
So I defined an async function:
`Execution result = await functions.createExecution( functionId: '65fd719a000f460e4896', body: body, method: 'POST', headers: headers, xasync: true);
var executionId = result.$id;
Execution execution = await functions.getExecution(
functionId:functionId, executionId: executionId);
while (
execution.status == 'waiting' || execution.status == 'processing') {
await Future.delayed(Duration(seconds: 5));
execution = await functions.getExecution(
functionId: functionId, executionId: executionId);
}`
The function is completed but I get the following error FormatException: SyntaxError: Unexpected end of JSON input
print(result.responseBody); does not print anything but I can see in the Admin console the body printed which is a valid JSON.
Why do I have the problem?
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...