My collection has Create and Read permissions for Any. but still, when i try to add a doc giving update and delete permission to a specific user, it throws the above error. the error doesn't pop up if I don't pass any permissions. but in that case, no user will be able to update/delete that doc. any idea why it's happening and how to solve it?
lemme know if any more info is needed
Framework: NextJS@13 Appwrite: Cloud
Is this related? https://discord.com/channels/564160730845151244/1169138259180396604
yeah kinda. the only difference is, OP facing this issue with functions, while i'm with documents. but what OP described as the reason after a few replies, doesn't really make sense to me tbh. the document has Create access to Any, which means anyone can create documents in that collection. then why i can't set permissions for the new doc while creating that?
sure you have permissions to create, but that doesn't mean you can create anything you want. just like how to can't put a string bigger than the size or an enum value that isn't defined.
A user cannot set a permission they do not have
I figured this out by changing permissions to "All Users".
If you're still running into this issue, @ me
I actually want to create a user doc after the user signs up. so I'm first calling account.create
and then databases.createDocument
. so what can be the workaround in this scenario? i need to give the update and delete permission for the new doc to the newly created user
still running into this issue @HmongDev
Try creating a session before creating the document
if i handle the whole sign-up process (both user and doc creation) in a server function, will it have full access to set the permissions for the user?
Yes, API keys can have full access provided they have an API key with the relevant scopes
Sorry, just saw this now. I'm sure @Steven can help you out.
[SOLVED] Permissions must be one of: (any, guests)
Recommended threads
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...