[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
- How to access oldValue payload in functi...
I want to record old and new values of data changes as audits. But when i try to read row in function. The value is new already even before grt updated
- Database table mysteriously empty this m...
Hello, I'm testing out appwrite (free) with a simple vue app. This morning a I created a few indexes on a table, and then noticed that it was empty... I don't e...
- Issue: Getting 401 Unauthorized Error Wh...
Hi team, I'm encountering a 401 user_unauthorized error when trying to create a row in my projects table, even though I have full user permissions configured fo...