Skip to content
Back

account.delete is not a function

  • 0
  • React Native
  • Cloud
Joe-TVN-MasterMind
2 Nov, 2024, 14:37

hi guys, i'm a junior dev building my first app on react navide with appwrite cloud, i'm trying to build the function so users could delete their account, data and user but i'm gettin the same error all the time account.delete is not a function, i saw some changes on appwrite about delete account but just cant understand right how to do(function on appwrite console?) so if anyone could help me with that i'll appreciate a lot! there's my code now: export const deleteAccountAndData = async () => { try { const currentAccount = await account.get(); const userId = currentAccount.$id; console.log('cuenta obtenida')

const userDocument = await databases.listDocuments(databaseId, userCollectionId, [Query.equal('accountId', userId)]); if (userDocument.documents.length > 0) { await databases.deleteDocument(databaseId, userCollectionId, userDocument.documents[0].$id); console.log('documento usuario eliminado') }

TypeScript
    await account.delete(userId);
    console.log('cuenta eliminada')

} catch (error) {
    console.error("Error eliminando la cuenta y datos del usuario:", error);
    throw new Error(error.message);
}

};

TL;DR
Issue: Developer is getting an error "account.delete is not a function" while trying to implement user account deletion feature using Appwrite Cloud functions in a React Native app. Solution: Instead of calling `account.delete(userId)`, use `deleteAccount(userId)` to delete the account. This should resolve the issue and successfully delete the user account and data.
Axistro
2 Nov, 2024, 15:45

Account can be deleted by a server side application or you can use cloud function

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