Back

A bug erased a database

  • 0
  • Databases
42Tom
29 May, 2023, 13:36

Hello,

While testing a function that updates references in a database, my database got erased with no warning or indication. Here is a Gist of the function that I executed: https://gist.github.com/t0mm4rx/c38e6c1116d3c2e4b4ea40a0b18899cf Logs of the appwrite container are included. You can see that the issue happened before the Database not found exception.

The function has never called deleteDatabase.

  1. This is a pretty severe bug that should be fixed
  2. Any way I can retrieve my data?
TL;DR
Title: Bug erased database; Possible solution provided Messages: - Bug reported, reference to GitHub issue provided. - User shares a snippet of code showing where the bug may be. - User suggests creating an issue on GitHub. - Temporary solution provided: reuse collectionId from a specific source. - User expresses hope for a quick fix as they were about to deploy the function. - User shares related link to Discord channel. - User wonders if the bug caused their data loss and asks for a possible solution. - User provides a function for testing purposes. - User shares details of the bug and includes logs. - User emphasizes severity of the bug
42Tom
29 May, 2023, 13:39

Maybe it's linked to this line:

TypeScript
await database.deleteDocument(
      '645e69708e42a5f150cd',
      '',
      sourcePrice.$id,
    );

where I called deleteDocument without specifying a collection.

Maybe you can test on your side?

42Tom
29 May, 2023, 13:49

I hope this will be fixed soon, I was about to ship this function in production would have been very painful

Bouahaza
29 May, 2023, 13:51
Bouahaza
29 May, 2023, 13:52

I suggest you create an issue on github

42Tom
29 May, 2023, 14:28

Yes great idea

42Tom
29 May, 2023, 14:32

Done

Drake
29 May, 2023, 14:46

Yes, this is the problem. Why would you leave it blank?

42Tom
29 May, 2023, 14:52

Forgot to fill it while copy / pasting previous code.

Drake
29 May, 2023, 14:54

I see. We're working on this. See https://github.com/appwrite/appwrite/issues/5310

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