This can happen because of the termination of firebase client, If you are using a secondary firebase app with multiple configuration depending upon environments you need to check if the client is already terminated somewhere else before initialisation of new firebase app.
Note- Firebase app termination is a async call.