[SOLVED] Creating collection with Server SDK and reading from it on Client SDK
- 0
- Flutter
- Functions
- Cloud
I am creating collection by function execution and then check if execution was successful then get its documents but hence leads to unauthorized_scope error. Remember users permissions are provided in server side function execution. After HotReload everything works fine and same user can get all documents from newly created Collection.
I think after successful execution of functions which creates Collection, it's attributes, indices and set Permissions, "completed" status is returned while permissions are not created yet. @Moderator
Seems like the user doesnt has permission for a document?
If you have appwrite 1.3.x upgrade to the last version 1.3.4, since previous had a problem with permissions migration
@Hassanmrwt could you share the code for this function?
Sure
Full code in file
Function works fine, completes it's execution but accessing newly created Collection's documents throws permissions error
okay here's what i can think of
in your function code, you're not await-ing every call to create attributes, etc.
which is causing the code to jump through without even checking if the execution of each call was complete. And hence you get the status: ok
what i would do is
Find a way to cheat my code Closed the code in try {
from where error is thrown
db.listDocuments() }on AppwriteException { called the same above code again and works fine }
ππ
await each of these calls amd try again. might slow it down a little, but might work!
Yes this could be the exact error let me go through this again and see what's happen
not exactly a good practice for production π
Yes
let me know! if i stop replying, I've fallen asleep π it's way past my bed time lmaoooo
Have nice dreams π€
Yes π did work π
Just awaited on creating attributes and index
Sounds good!
[SOLVED] Creating collection with Server SDK and reading from it on Client SDK
Recommended threads
- My account is blocked so please check an...
My account is blocked so please unblock my account because all the apps are closed due to which it is causing a lot of problems
- Applying free credits on Github Student ...
So this post is kind of related to my old post where i was charged 15usd by mistake. This happens when you are trying to apply free credits you got from somewh...
- Attributes Confusion
```import 'package:appwrite/models.dart'; class OrdersModel { String id, email, name, phone, status, user_id, address; int discount, total, created_at; L...