
What i am doing wrong?

Can you try to add the any role to the collection?

It works with Any

Is the problem related with client-side session ?

So you might not have a session then. Did you log in first?

I got session on server not client

Createdocument requires client session?

How?

You set the collection permissions to users. That means only logged in users (session)

Third photo i use next-auth with appwrite rest apis

I see so this createDocument()...is that being executed server side with the session cookie?

No Createdocument is now in nextjs client component

So if there's no session, that would explain the error.

Ok I understand now

Btw, since you're creating the session server-side, if you have Appwrite running on a subdomain of your app and you have your app set a cookie, the same cookie should be used for both Appwrite and your app

So the Createdocument function work if only appwrite has the session on browser not only in user dashboard

See this repo for setting the session on the server and client side: https://github.com/Meldiron/appwrite-ssr-next-js

Ok , thanks for explaining
Recommended threads
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Organization not exists anymore
Hello! We have a problem with a cloud database. We are on the Free plan, but after a refresh the site wants me to create a new organisation, and I not see the c...
- JSON and Object Support in Collection do...
I am working with Next.Js and Appwrite Cloud, I am relatively New to Appwrite but i have noticed there is no direct support of JSON and Object support in attrib...
