Back

[SOLVED] Permissions must be one of: (any, guests)

  • 0
  • Databases
  • Web
manazo
1 Nov, 2023, 10:00

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

TL;DR
User is getting an error message saying "Permissions must be one of: (any, guests)" when trying to set permissions for a new document. They are using NextJS@13 and Appwrite Cloud. Solution: The issue was resolved by changing the permissions to "All Users" instead of specifying a specific user.
Haimantika
1 Nov, 2023, 11:41
manazo
1 Nov, 2023, 15:24

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?

Drake
1 Nov, 2023, 17:19

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

beppoh
1 Nov, 2023, 17:45

I figured this out by changing permissions to "All Users".

beppoh
1 Nov, 2023, 17:45

If you're still running into this issue, @ me

manazo
3 Nov, 2023, 06:32

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

manazo
3 Nov, 2023, 06:32

still running into this issue @HmongDev

Drake
3 Nov, 2023, 06:34

Try creating a session before creating the document

manazo
3 Nov, 2023, 13:48

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?

Drake
3 Nov, 2023, 14:32

Yes, API keys can have full access provided they have an API key with the relevant scopes

beppoh
3 Nov, 2023, 16:07

Sorry, just saw this now. I'm sure @Steven can help you out.

manazo
8 Nov, 2023, 15:48

[SOLVED] Permissions must be one of: (any, guests)

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more