I tried all the things, but the functions is always getting timed out, after about 15-17 seconds, heres the code
import 'dart:async';
import 'package:dart_appwrite/dart_appwrite.dart';
Future<void> start(final req, final res) async {
final client = Client();
final database = Databases(client);
final document = await database.createDocument(
databaseId: '6489ef1fb252d4ac177d',
collectionId: '6489ef320a5a9b83cd78',
documentId: 'unique()',
data: {...},
);
res.json({document.toMap()});
}
Be sure to set your Client with you server data
Client client = Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('[PROJECT_ID]')
.setKey('919c2db5d4...a2a3346ad2');
You can read more about it here https://appwrite.io/docs/getting-started-for-server.
But if im running it in functions, then also?
If so, do i generate a key for the same?
Yep
Its actually a appwrite functions code that ive pushed
this one didnt had any, so got confused
Appwrite function are isolated. So if you want to connect to Appwrite then you'll to set the endpoint
Oook, my bad i didnt checked the below part
No worries
Its still getting timed out
I added project, endpoint, key and self signed
also the key has all the required permissions
Have you set the endpoint with localhost?
yes
It also has /v1 with it
and also tried without /v1
You do need to v1
But localhost can't be used inside a function
What you should do locally is to use your host IP address
What os you using
macOS
On apple silicon
Recommended threads
- DeploymentStatus enum value `canceled` m...
Hey, Sorry if it has been reported already, I found an issue using the Dart SDK where the `canceled` enum value is missing from `DeploymentStatus`. This causes...
- Synchronous function execution timeout w...
I am calling server functions with xasync = true and I still get this error message. Synchronous function execution timed out. Use asynchronous execution inste...
- Function running for more than 2 hours i...
This is my projectID: 669fe01b003800dd0503 Cloud functionID is 696ea05400147eb8eb3b I hope this doesn't count against my GB-hours?