[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
- Can't Login to Cloud Account
Dear <@870607367597850624> I used one of my Email account (hassanmrwt@gmail.com) for Cloud but that is not in my access now. System is prompting me to verify E...
- Function scheduling is not functional on...
Hello everyone! I'm using Appwrite Cloud and I have a function that runs every day at 00:00 UTC. Preciously it worked fine, but it didn't fire last night and i...
- CORS error only on tables db api After u...
I've recently updated my self hosted appwrite instance to the 1.8.0 and updated my frontend with the tables db apis but strangely, even if I'm able to log in, g...