The default Firebase app already exists
I have the following Flow:
1. Inputs
2. Switch based on one of the inputs
2.1. Condition 1: 'Execute BuildShip Workflow' pointing to a 2nd Flow
2.2. Fallback
3. Flow Output
The first time I execute it, the Flow Output returns the 2nd Flow output as expected.
After that, the 2nd Flow fails and its Firestore Collection Query node returns: "The default Firebase app already exists. This means you called initializeApp() more than once without providing an app name as the second argument. In most cases, you only need to call initializeApp() once. But if you do want to initialize multiple apps, pass a second argument to initializeApp() to give each app a unique name."
I tried adding a BuildShip Workflow Trigger to the 2nd Flow but now I think it's unnecessary since both flows are in the same workflow.
I found out that's a Firestore issue. There's plenty of documentation about how to solve it when you have your own code, but I don't know how to solve it from BuildShip.
I miss there's no BuildShip documentation about the Execute BuildShip Workflow node.
#firestoreIssue #ExecuteBuildShipWorkflowNodeIssue
1. Inputs
2. Switch based on one of the inputs
2.1. Condition 1: 'Execute BuildShip Workflow' pointing to a 2nd Flow
2.2. Fallback
3. Flow Output
The first time I execute it, the Flow Output returns the 2nd Flow output as expected.
After that, the 2nd Flow fails and its Firestore Collection Query node returns: "The default Firebase app already exists. This means you called initializeApp() more than once without providing an app name as the second argument. In most cases, you only need to call initializeApp() once. But if you do want to initialize multiple apps, pass a second argument to initializeApp() to give each app a unique name."
I tried adding a BuildShip Workflow Trigger to the 2nd Flow but now I think it's unnecessary since both flows are in the same workflow.
I found out that's a Firestore issue. There's plenty of documentation about how to solve it when you have your own code, but I don't know how to solve it from BuildShip.
I miss there's no BuildShip documentation about the Execute BuildShip Workflow node.
#firestoreIssue #ExecuteBuildShipWorkflowNodeIssue
Solution
Hi @Luis on the share flow via suppot request, you are using a custom-created Firestore Collection Query node, which has the issue in the node logic, you are initializing the App with firebasae-admin/app each time the filterFiresoreDocs function is executed. The app should not be initialized more than once. We already have a node for the collection query, I recommend you use the library node instead, which is using the google-cloud/firestore, to avoid this issue, you can modify it with AI to add an input for the array to query. Sent you an email as well.
