Hi guys -
I struggle with the cloud functions - I need to get Documents from 2 collections and then send it to the client. But I cannot find any documentation about listDocuments or something. I already tried graphql, but there I always get an error
I think there is just a small Syntax, but I tried long time and I also cannot find anything helpful...
I use appwrite CLI to deploy the function.
this is the error:
[response], {errors: [{message: Syntax Error: Expected :, found Name "collectionId", extensions: {category: graphql}, locations: [{line: 4, column: 11}]}]}
```
this is the code:
```
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:dart_appwrite/dart_appwrite.dart';
Future<dynamic> main(final context) async {
final client = Client()
.setEndpoint(endpoint)
.setProject(String.fromEnvironment(projectId))
.setKey(String.fromEnvironment(SecretKey));
final graphQL = Graphql(client);
final response = await graphQL.query(
query: {
'query': ''' query GetHubsAndPosts {
databasesListDocuments(
databaseId: $db_id,
collectionId: $collectionId
) {
total
documents {
_id
data
}
}
}
'''
},
);
context.log('[response], $response');
return response;
}
```
Do you need to use GraphQL? Or you'd be willing to use the dart sdk? Also, I don't see an import for the dart graphql package in your snippet. If you're willing to use the sdk here's the relevant documentation https://appwrite.io/docs/references/cloud/server-dart/databases
actually I do not really need to use graphql - so I tried this but I always get
Execution timed out.
just after 480ms
What is now the fault?
Thank you for your assistence
Recommended threads
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...