-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Bug Report: Functions always throw timeout error after creating user account during 1min #6195
Comments
I tried to make the issue reproductible to debug it & patch it :slight_smile: 1- So first create a very basic function in Dart: import 'dart:async';
import 'dart:io';
import 'package:dart_appwrite/dart_appwrite.dart';
Future<dynamic> main(final context) async {
final client = Client()
.setEndpoint(Platform.environment['APPWRITE_FUNCTION_ENDPOINT']!)
.setProject(Platform.environment['APPWRITE_FUNCTION_PROJECT_ID'])
.setKey(Platform.environment['APPWRITE_API_KEY'])
.setSelfSigned(status: true);
final databases = Databases(client);
try {
final response = await databases.listDocuments(
databaseId: 'DB_ID',
collectionId: 'SYNC_DB',
queries: [
Query.limit(100),
],
);
context.log('Fetched !');
context.log(response.documents.length.toString());
} catch (e) {
// You can also log errors to the console
context.error('There is an error!');
context.error(e.toString());
}
// `res.json()` is a handy helper for sending JSON
return context.res.json({
'motto': 'Build Fast. Scale Big. All in One Place.',
'learn': 'https://appwrite.io/docs',
'connect': 'https://appwrite.io/discord',
'getInspired': 'https://builtwith.appwrite.io',
});
} 2- Add API key to function which had documents list permissions at minimum _account.createOAuth2Session(); 5- Direct after login success, execute the function with a button for example _functions.createExecution(
functionId: '64fecda6870bb9d745ed',
body: jsonEncode(
{
'data': true,
},
),
method: 'POST',
); And you will get |
@istornz, thanks so much for the details! 🙏🏼 I'll try to reproduce this as soon as I can. |
👟 Reproduction steps
This bug is very strange :/
account.createOAuth2Session()
(I tried with Apple only)Execution timed out.
.If you do the same steps BUT at step 5. wait ~1min (just do nothing at all, just take a coffee ☕️) & then call the function: it works well 😅.
After waiting this time it always work.
My supposition is when creating a new user, Appwrite has a process in background, we need to wait this process to finish & then we can launch functions.
👍 Expected behavior
During the first ~1min, try to call the function, it should work & not throw error.
👎 Actual Behavior
During the first ~1min, try to call the function, it throw error
Execution timed out.
🎲 Appwrite version
Version 1.4.x
💻 Operating system
Linux
🧱 Your Environment
I use Hetzner with 2 vCPU, 4GB Ram, 20Gb disk storage (CX21 offer)
Appwrite version: 1.4.2.
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: