try to write to the database, but am getting error
Error creating driver [Error: Error: AppwriteException: Permissions must be one of: (any, guests)]
const createDriverDoc = async (user: DriverUser, userId: string) => {
  try {
    const id = await databases.createDocument(
      DATABASE_ID,
      DRIVER_COLLECTION_ID,
      ID.unique(),
      {
        userId: userId,
        firstName: user.firstName,
        lastName: user.lastName,
        phone: user.phone,
        gender: user.gender,
        email: user.email,
        avatar: user.avatar,
        vehencleType: user.vehencleType,
      },
      [
        Permission.read(Role.any()),
        Permission.write(Role.user(userId)),
        Permission.update(Role.user(userId)),
        Permission.delete(Role.user(userId)),
      ]
    );
    return id;
  } catch (error: any) {
    throw new Error(error);
  }
};
If you have write you don't need update and delete. Write is an alias for create/update/delete.
How are you initializing your appwrite client?
What are the permissions on this collection?
import {
  Client,
  Account,
  Databases,
  Functions,
  Storage,
} from "react-native-appwrite";
export const client = new Client()
  .setEndpoint("https://cloud.appwrite.io/v1")
  .setProject("***")
  .setPlatform("***");
export const databases = new Databases(client);
export const account = new Account(client);
export const functions = new Functions(client);
export const storage = new Storage(client);
What are the permissions on your collection
this is the collection permission
Do you have any relationships?
no, no relationships
Is the userId you're setting permissions for, the user that is actively logged in? The error means that the user is trying to set permissions for something besides themselves
thanks, I had to logged the user in first
[SOLVED] Permission error
Recommended threads
- Dynamic Roles
I tried to store a row with this permissions: permissions.push( Permission.read(Role.users("verified")), Permission.write(Role.label(`c-${calend...
 - Column size update error – "Invalid inde...
Hey everyone, I’m running into an issue when trying to update the size of an existing column in my Appwrite database. I’m trying to change the size from 30 to 5...
 - Invalid query: Attribute not found in sc...
Hiya. I'm trying to use the REST API with documents and doing a simple select with query: https://<mydomain>/v1/databases/<database>/collections/<collection>/d...