I am having problems with a dockerised Java application that uses the Firebase Admin SDK to make updates to a Firebase Realtime database.
This code has worked well for years in a Google hosted environment, and has just been moved to a private server (our apps Firebase authentication has been updated as described in the docs).
The code that performs the writes is straight-forward (log messages simplified):
db.setValue(value, (DatabaseError databaseError, DatabaseReference databaseReference) -> {
if (databaseError == null) {
log.info("Write operation completed...");
} else {
log.warn("Write operation failed...");
}
});
When testing locally, this code works perfectly well and the CompletionListener
logs the call completions as expected.
When running in our new production environment, the problem I am encountering is slightly different depending on the version of the firebase-admin library I use.
With this older version of the Admin SDK:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>8.2.0</version>
</dependency>
The code runs as expected for a number of hours but then starts to fail silently – i.e. the calls to setData
are being made but the database is not updated and no callbacks are received by the CompletionListener
.
With no callbacks, there are no error messages to indicate what has stopped working.
With later versions of the SDK (tested 9.2.0 and 9.3.0)
After updating to the most recent versions of the API, all calls fail as described above, ie. the CompletionListener
callback is never called.
Steve Neal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.