firebase / firebase/firebase-admin-node

[FR] Add a function that initializes an App or returns existing one

Open
#2,314 1 comment 0 reactions 0 assignees View on GitHub
api: core type: feature request
Dominant language
TypeScript
Stars
1.7k
Forks
419
Avg merge
3d 10h
Merged PRs (30d)
16

Description

**Is your feature request related to a problem? Please describe.**
A function `initializeApp` throws an error if the app is already existed at the time. As current workaround, we need to handle thrown error.
(related: https://github.com/firebase/firebase-admin-node/issues/2111 )

**Describe the solution you'd like**
Add a function wrapping `initializeApp` and `getApp`, that returns existing FirebaseApp, or initialize a new FirebaseApp if the app doesn't exist.

my sample implementation: https://github.com/arayaryoma/firebase-admin-node/commit/65be1703a0c4f8ede7fd34c63d71e05b38f48efb

**Describe alternatives you've considered**
Not yet

**Additional context**
If this proposal is affirmed, I can open a PullRequest.

Contributor guide

Open the contributing guide

Research direction

Start by locating the exported initializeApp and getApp entry points and their existing tests. The work is done when the new function returns an existing FirebaseApp or initializes one when none exists, with tests covering both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, node.js, typescript
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.