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
- Function domain not available
Hello, even tho in docs you clearly describe that every function has its domain, I can not see it anywhere in any of my projects. How do I reveal the url of th...
- Inquiry: How to Reduce Cold Start Durati...
Hey! I was using Python for the function runtime, but after reading that Go has the fastest runtime, I switched my code over to Go. However, I'm still seeing co...
- After a GET request is passed to functio...
Create execution in the console can normally retrieve the get parameters。WHy?