Back

databases.deleteAttribute and createBooleanAttribute, race condition

  • 1
  • Databases
  • Functions
FUZZY
10 Jun, 2024, 04:36

Hello, I wonder if once databases.deleteAttribute returns, is the attribute being processed to delete or already deleted. What I did is databases.deleteAttribute().then(() => { databases.createBooleanAttribute()}) to reset all fields in this attribute daily and my observation is that sometimes appwrite throws "Attribute with the requested key already exists". I am on appwrite 1.5.7, node-appwrite 12.0.0 btw.

TL;DR
Developers are questioning the status of an attribute after using databases.deleteAttribute. They are experiencing a race condition as databases.createBooleanAttribute is sometimes throwing an error. The issue may be due to the deletion status of the attribute not being guaranteed upon the function's completion. This behavior might be a bug in appwrite versions 1.5.7 and node-appwrite 12.0.0. It is recommended to add error handling or delay the creation of the attribute to ensure it happens after successful deletion.
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