'Unable to connect NodeMCU with Firebase as console shows setting /number failed: each time

Unable to connect NodeMCU with Firebase as console shows setting /number failed: each time No updation on firebase as well.

or should I change the cloud server?

    #include <ESP8266WiFi.h>
    #include <FirebaseArduino.h>

    // Set these to run example.
    #define FIREBASE_HOST "example.firebaseio.com"
    #define FIREBASE_AUTH "token_or_secret"
    #define WIFI_SSID "SSID"
    #define WIFI_PASSWORD "PASSWORD"

    void setup() {
      Serial.begin(9600);

      // connect to wifi.
      WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
      Serial.print("connecting");
      while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(500);
      }
      Serial.println();
      Serial.print("connected: ");
      Serial.println(WiFi.localIP());

      Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
    }

    int n = 0;

    void loop() {
      // set value
      Firebase.setFloat("number", 42.0);
      // handle error
      if (Firebase.failed()) {
          Serial.print("setting /number failed:");
          Serial.println(Firebase.error());  
          return;
     }
      delay(1000);
    }


Solution 1:[1]

The Firebase Arduino library has a reference to a fingerprint of the Firebase SSL certificate. This fingerprint may not match the current fingerprint.

This fingerprint is in FirebaseHttpClient.h (typically in C:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h).

To find and change the current fingerprint:

  1. Go to https://www.grc.com/fingerprints.htm
  2. Enter "test.firebaseio.com"
  3. Record the fingerprint (e.g. it is currently 03:9E:4F:E6:83:FC:40:EF:FC:B2:C5:EF:36:0E:7C:3C:42:20:1B:8F
  4. OpenC:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h
  5. Replace value of kFirebaseFingerprint with the fingerprint (without colons)
  6. Recompile

e.g. the following fingerprint works at this point of time:

static const char kFirebaseFingerprint[] =
  "03 9E 4F E6 83 FC 40 EF FC B2 C5 EF 36 0E 7C 3C 42 20 1B 8F";

See https://github.com/FirebaseExtended/firebase-arduino/issues/328

Solution 2:[2]

Only one change is required for the above answer That is instead of "test.firebaseio.com" we have to put our project's FIREBASE_HOST address

and that solved my problem

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Naveena Poojari