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
- 1:1 relationship doesn’t sync after re-a...
Hi, I’m trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...
- Failed to create function
Hey everyone 👋 I'm having an issue creating Functions on Appwrite Cloud and I'm not sure if it's a platform bug or something wrong in my project. When I try t...
- Upsert with setting permissions
Hi there, I am using self-hosted appwrite v1.7.4 and trying to use the bulk update stuff that was released with 1.7.x. Unfortunally I found that there is an ser...