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
- I can't UNPAUSE my project with the free...
I received an email notifying me that my project had been paused due to inactivity, and the email included a link to "Restore project." However, that button red...
- Error trying to deploy functions from CL...
✗ Error • on-auth-create (6a00b2ab000c9ce2949b) • Server Error ✗ Error: No functions were pushed. Prject ID: 69ffe0270033a4ac420a
- Intermittent Deploy and Execution Errors...
Project: project-fra-658e2f5f4ba30df91177 Function ID: 69bde006001c56757f49 **Several execution errors with:** Timed out waiting for runtime.\nError Code: 400...