Reputation: 11
After being forced to update my firebase code to 6.1, I have come across the issue of this code snippet not properly checking to see if the default app has been initialized.
if(!admin.apps.length)
{
admin.initializeApp();
}
This was working fine before and now it never initializes the app.
Upvotes: 0
Views: 16
Reputation: 11
I changed my code to
if(!admin.apps.length || admin.apps.length === 1)
{
admin.initializeApp();
}
it turns out that admin.apps length is 1 when there isn't a default app initialized and it now works correctly as it did before. Hopefully this helps out someone else with the same problem.
Upvotes: 1