mobizt / FirebaseClient

🔥Async Firebase Client for Arduino. Supports Realtime Database, Cloud Firestore Database, Firebase Storage, Cloud Messaging, Google Cloud Functions and Google Cloud Storage.
MIT License
134 stars 8 forks source link

Database.set return is true even if data was not setted! #103

Closed EgHubs closed 5 months ago

EgHubs commented 5 months ago

Describe the bug Database.set return is true even if data was not set!

To Reproduce Just used the Database.set(sync) example, only added my firebase api-key, rtdb link,user and wifi data and only updated the section that is there to change the data to the following


    Serial.println("Synchronous Set... ");

    // Set string
    Serial.print("Set String... ");
    status = Database.set<String>(aClient, "/usersData/s/FireFromArduino/MID2", "hello");
    if (status)
        Serial.println("okS");
    else
        printError(aClient.lastError().code(), aClient.lastError().message());
            Serial.print("Set2222 String... ");
    status = Database.set<String>(aClient, "/usersData/hVYUSwsES2NvQH5M2SGiNwWign23/FromArduino/MID2", "hello");
    if (status)
        Serial.println("okS22");
    else
        printError(aClient.lastError().code(), aClient.lastError().message());

(just deleted the boolean, int, double,, things) and i had my Firebase security rules to only allow the user to add under its UID

{
  "rules": {
  "usersData": {
  "$user_id": {
  ".write": "auth.uid != null &&$user_id === auth.uid",
  ".read": "auth.uid != null &&$user_id === auth.uid"
}
  }
  }
}

Expected behavior the first one should return an error and the second one should return ok instead, they both returned ok

Synchronous Set... Set String... okS Set2222 String... okS22

and the second one is the only one that is verified to be written live on the Firebase database

I returned to this original example to test it as in my code it dose the same, also the same true return is gotten when there is no internet connection!

IDE and its version:

mobizt commented 5 months ago

The issue was fixed in v1.2.15. You can update and try it.