Back

[SOLVED] Error creating document with permission

  • 0
  • Databases
  • Flutter
laurencetroyv
4 Nov, 2023, 18:22

cannot create a document with permission even though there is a user session

TL;DR
User is experiencing an error when trying to create a document with permissions. They are unsure about how to use functions and integrate realtime into their application. The error is caused by a null value in a document relationship. User asks if document permissions can be set on the client side and tries to add permissions on the Appwrite cloud, but encounters a server error. Solution: The issue can be solved by creating a small server-side function to create the document with the desired permissions. Client-side permissions cannot be set for other users.
D5
4 Nov, 2023, 18:23

This is client side, right?

laurencetroyv
4 Nov, 2023, 18:23

yes

D5
4 Nov, 2023, 18:23

Uh, I think that's the issue

D5
4 Nov, 2023, 18:23

You cannot set permissions for other people client sided

laurencetroyv
4 Nov, 2023, 18:23

ohh thats why

D5
4 Nov, 2023, 18:23

So you will need a small function to create the document

laurencetroyv
4 Nov, 2023, 18:23

my bad

D5
4 Nov, 2023, 18:24

Tell me if doing it server sided solves the issue

laurencetroyv
4 Nov, 2023, 18:34

tried adding it on the appwrite cloud, it gives a server error

D5
4 Nov, 2023, 18:37

Maybe it's incorrect?

laurencetroyv
4 Nov, 2023, 18:38

I think I found the problem

laurencetroyv
4 Nov, 2023, 18:39

ahh nope it still gives an error

laurencetroyv
4 Nov, 2023, 18:40

yes I found the problem

laurencetroyv
4 Nov, 2023, 18:40

thank you

laurencetroyv
4 Nov, 2023, 18:41

is there a way to add document permission in the client side?

D5
4 Nov, 2023, 18:55

I think not. Just permissions for the current user

D5
4 Nov, 2023, 18:55

Just to say functions are very easy to use

D5
4 Nov, 2023, 18:55

What was the problem?

laurencetroyv
4 Nov, 2023, 19:01

the document has a relationship but the value was null, thats why its giving an error

D5
4 Nov, 2023, 19:01

Oh, I see

laurencetroyv
4 Nov, 2023, 19:12

I'm still having a hard time understanding functions, mayble a little bit I integrate realtime to my thesis application 🀣

laurencetroyv
5 Nov, 2023, 19:57

βœ” Error creating document with permission

laurencetroyv
5 Nov, 2023, 19:58

[SOLVED] Error creating document with permission

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