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's Static IP
Is it possible to have static. IP Address instead of Dynamic IP for getting the IP Address whitelist
- How to use dart workspaces to deploy a f...
Hello, I'm developing a Flutter application and I would like to leverage dart pub workspaces to deploy a function with a dart runtime as advertised here : http...
- [SOLVED] Unable to push function from AP...
When trying to push functions from Gitlab CI (with an API KEY and using the CLI), i saw that i was unable to push functions. ``` $ appwrite client --endpoint $...