I am experiencing intermittent "Connection Refused" errors when using the Firebase ESP32 library (version 4.4.8) to update data in the Firebase Realtime Database. The issue seems to occur sporadically and is not consistently reproducible.
I am using an ESP32 development board (specifically, the ESP32 Lolin D32 Pro) and Arduino IDE 2.2.1. My Firebase JSON structure is relatively simple and does not have any complex nesting.
Here is an example of the code I am using to update Firebase data:
jsontest.clear();
// ... Setting various Firebase values ...
if (Firebase.updateNode(fbdo, "test", jsontest)) {
Serial.println(" ---> test PASSED: updateNode!");
} else {
Serial.println(" ---> REASON: " + fbdo.errorReason());
}
// ...
While the connection works most of the time, there are instances when it returns "Connection Refused." However, if I reset the ESP32 and establish a new connection, the issue disappears temporarily.
I have also attempted to create a new FirebaseData object (fbdo) before each update, but the problem persists, suggesting that it may not be related to the fbdo object itself.
Is there a way to reset or re-establish the Firebase connection without resetting the entire ESP32? I am wondering if there might be an issue related to WiFi connection state or socket management that could be causing this problem.
Thank you for your assistance. I appreciate your help in resolving this issue.
Hello,
I am experiencing intermittent "Connection Refused" errors when using the Firebase ESP32 library (version 4.4.8) to update data in the Firebase Realtime Database. The issue seems to occur sporadically and is not consistently reproducible.
I am using an ESP32 development board (specifically, the ESP32 Lolin D32 Pro) and Arduino IDE 2.2.1. My Firebase JSON structure is relatively simple and does not have any complex nesting.
Here is an example of the code I am using to update Firebase data:
include
// ...
FirebaseJson jsontest; FirebaseData fbdo; FirebaseAuth auth; FirebaseConfig config;
// ...
config.database_url = FIREBASE_HOST; config.signer.tokens.legacy_token = FIREBASE_AUTH; Firebase.begin(&config, &auth); Firebase.reconnectWiFi(true); Firebase.setMaxRetry(fbdo, 3); Firebase.setMaxErrorQueue(fbdo, 30); fbdo.setResponseSize(8192);
jsontest.clear(); // ... Setting various Firebase values ...
if (Firebase.updateNode(fbdo, "test", jsontest)) { Serial.println(" ---> test PASSED: updateNode!"); } else { Serial.println(" ---> REASON: " + fbdo.errorReason()); }
// ...
While the connection works most of the time, there are instances when it returns "Connection Refused." However, if I reset the ESP32 and establish a new connection, the issue disappears temporarily.
I have also attempted to create a new FirebaseData object (fbdo) before each update, but the problem persists, suggesting that it may not be related to the fbdo object itself.
Is there a way to reset or re-establish the Firebase connection without resetting the entire ESP32? I am wondering if there might be an issue related to WiFi connection state or socket management that could be causing this problem.
Thank you for your assistance. I appreciate your help in resolving this issue.
Best regards, Helmar Alvares