Skip to content

Commit b47adf3

Browse files
authored
Merge pull request #25 from FlutterFlow/update/firebase-docs-cloud-fn-faq
Update Firebase integration setup + Add FAQ
2 parents 56a4ba3 + d8e9f88 commit b47adf3

File tree

4 files changed

+212
-0
lines changed

4 files changed

+212
-0
lines changed

docs/integrations/firebase.md

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,42 @@ Once complete, Dreamflow will confirm the connection with a **Connected** status
4848
</div>
4949
<p></p>
5050

51+
### First-Time Firebase Project Setup
52+
53+
If this is your first time connecting to Firebase, you must create a new project in the Firebase Console and accept the Terms of Service before continuing.
54+
55+
Open the Firebase Console and ensure you are signed in with the correct account. Click **Get started** tile, enter a project name, accept the terms, and complete the setup. During this process, you can disable Gemini AI and Analytics features if they are not required.
56+
57+
When the console displays the message *“Your Firebase project is ready”*, close the tab and return to Dreamflow. Click **Proceed** to continue. It may take a few minutes for the new project to appear in Dreamflow.
58+
59+
Here’s how to do it step by step:
60+
61+
62+
<div style={{
63+
position: 'relative',
64+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
65+
height: 0,
66+
width: '100%'}}>
67+
<iframe
68+
src="https://demo.arcade.software/5cXsTxpPsUIFxMP1JrDS?embed&show_copy_link=true"
69+
title=""
70+
style={{
71+
position: 'absolute',
72+
top: 0,
73+
left: 0,
74+
width: '100%',
75+
height: '100%',
76+
colorScheme: 'light'
77+
}}
78+
frameborder="0"
79+
loading="lazy"
80+
webkitAllowFullScreen
81+
mozAllowFullScreen
82+
allowFullScreen
83+
allow="clipboard-write">
84+
</iframe>
85+
</div>
86+
<p></p>
5187

5288
## 2. Project Setup
5389

@@ -176,3 +212,179 @@ This step is critical for security, as without rules, your Firestore may be open
176212

177213
![deploy-to-firebase.avif](imgs/deploy-to-firebase.avif)
178214

215+
## 5. Configure Authentication
216+
217+
If the generated client code includes authentication-related functionality, you must configure sign-in providers in the Firebase Console to make it work.
218+
219+
To enable authentication, click **Configure Authentication**. This opens the Authentication page in the Firebase Console, where you can select a sign-in provider such as Email/Password, Google, or Facebook. Enable the chosen provider, configure its settings (for example, OAuth credentials for Google or Facebook), and click **Save**. Repeat this process to enable any additional providers required by your app.
220+
221+
Here’s an example of enabling email/password authentication:
222+
223+
<div style={{
224+
position: 'relative',
225+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
226+
height: 0,
227+
width: '100%'}}>
228+
<iframe
229+
src="https://demo.arcade.software/rUFzONPrr5SSnRDTvy07?embed&show_copy_link=true"
230+
title=""
231+
style={{
232+
position: 'absolute',
233+
top: 0,
234+
left: 0,
235+
width: '100%',
236+
height: '100%',
237+
colorScheme: 'light'
238+
}}
239+
frameborder="0"
240+
loading="lazy"
241+
webkitAllowFullScreen
242+
mozAllowFullScreen
243+
allowFullScreen
244+
allow="clipboard-write">
245+
</iframe>
246+
</div>
247+
<p></p>
248+
249+
## Add Sample Data to Firebase
250+
251+
Dreamflow lets you add sample data to your Firebase project for easier development and testing. The generated data follows your app’s schema, so you can quickly check how your app works with populated users, collections, and documents.
252+
253+
To add sample data from Dreamflow, go to the **Firebase** module **> Add Sample Data to Firebase**. Enter the email address of your test account in the **User Email** field. This account will be associated with the generated sample data. Click **Generate Sample Data**.
254+
255+
Once the process is complete, you will see the generated sample data entries inside your **Cloud Firestore** under the respective collections defined in your schema.
256+
257+
:::info
258+
259+
This process only inserts sample data into the **Firestore Database** for the specified user email. It does **not** create a user in Firebase Authentication. Make sure the user with the specified email exists in Firebase Authentication to be able to access the data.
260+
261+
:::
262+
263+
![add-sample-data.avif](imgs/add-sample-data.avif)
264+
265+
## Enable Billing
266+
267+
Certain Firebase services, such as [Cloud Functions](https://firebase.google.com/docs/functions), require billing to be enabled before they can be used. If your project uses other Firebase services beyond their free tier limits, for example, Cloud Firestore, Cloud Storage (over 5 GB), or Phone Authentication (billed per SMS), you must enable billing on your Firebase project.
268+
269+
To enable billing on your Firebase project, open the Firebase Console. On the project dashboard, click on the current plan and select the **Blaze** plan. You can either create a new billing account or link an existing one. During setup, you can also set a budget amount. Once your usage exceeds this amount, you will receive an email notification. After enabling, the Blaze plan will appear on your project dashboard.
270+
271+
272+
<div style={{
273+
position: 'relative',
274+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
275+
height: 0,
276+
width: '100%'}}>
277+
<iframe
278+
src="https://demo.arcade.software/7Z5BmfA19TkPrXV2pPuX?embed&show_copy_link=true"
279+
title=""
280+
style={{
281+
position: 'absolute',
282+
top: 0,
283+
left: 0,
284+
width: '100%',
285+
height: '100%',
286+
colorScheme: 'light'
287+
}}
288+
frameborder="0"
289+
loading="lazy"
290+
webkitAllowFullScreen
291+
mozAllowFullScreen
292+
allowFullScreen
293+
allow="clipboard-write">
294+
</iframe>
295+
</div>
296+
<p></p>
297+
298+
299+
## FAQs
300+
<details>
301+
<summary> Why do cloud function deployments fail? </summary>
302+
303+
<p>
304+
Cloud function deployments usually fail when your Google Cloud Platform (GCP) or Firebase project hasn’t been fully set up with the necessary APIs and permissions.
305+
306+
By default, when you create a new Firebase project, some APIs required by Cloud Functions are not enabled automatically. In addition, the default compute service account may not have the correct roles to deploy functions. Without these APIs and permissions, Dreamflow cannot deploy functions successfully, and you’ll see deployment errors.
307+
308+
Follow the steps below to fix the issue:
309+
310+
1. To be able to deploy and run cloud functions, make sure to [**enable billing**](#enable-billing) for your Firebase/GCP project.
311+
2. If you haven’t already, [**enable the authentication**](#5-configure-authentication) in the Firebase console.
312+
3. Next, open your browser and navigate to the following URL: `https://console.cloud.google.com/functions/list?referrer=search&hl=en&project=<projectID>` Replace `<projectID>` with your GCP or Firebase project ID.
313+
4. Click on the **Create Function** button. GCP will prompt you to enable the necessary APIs: **Cloud Build** and **Cloud Functions**.
314+
5. After clicking **Next**, you will be prompted to enable the **Cloud Run Admin API**.
315+
316+
![cloud-run-admin-api](https://docs.flutterflow.io/assets/images/cloud-run-admin-api-6289d1d79337a0f909d0e29e555335f6.png)
317+
318+
6. Now, you need to grant the default compute service account the appropriate permissions. In the next page, you will see the option to deploy an example cloud function like `helloHttp`. Deploy this function. You will be prompted to grant permissions to the default compute service account. The message will look like: `You need to grant the following roles to the build service account to deploy a function: roles/cloudbuild.builds.builder to <projectID>[email protected].`
319+
7. Click **Grant** to provide the required permissions and deploy the example cloud function. Once deployed, you can delete this function if you wish.
320+
8. After completing these steps, go to **Dreamflow > Firebase > Deploy to Firebase**. Under Deployment Target, select **Functions** and click **Deploy Changes**.
321+
322+
![deploy-cloud-functions.avif](imgs/deploy-cloud-functions.avif)
323+
324+
325+
With the required permissions granted and correct configurations, you should now be able to deploy cloud functions from Dreamflow without any issues.
326+
</p>
327+
328+
</details>
329+
330+
<details>
331+
<summary>
332+
Why do I see the error `[cloud_firestore/failed-precondition] The query requires an index`?
333+
</summary>
334+
335+
<p>
336+
This error occurs when Firestore needs a composite index to run your query, but the index has not been created yet.
337+
338+
When this error appears, it includes a link to the Firebase Console. Open that link, and it will redirect directly to the required index creation page in your Firestore project. Simply click **Save** to create the index.
339+
340+
After the index is built (this may take a few minutes), retry running your app. The query should now work without errors.
341+
342+
<div style={{
343+
position: 'relative',
344+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
345+
height: 0,
346+
width: '100%'}}>
347+
<iframe
348+
src="https://demo.arcade.software/xJppTqks1wSl1xE5yw5p?embed&show_copy_link=true"
349+
title=""
350+
style={{
351+
position: 'absolute',
352+
top: 0,
353+
left: 0,
354+
width: '100%',
355+
height: '100%',
356+
colorScheme: 'light'
357+
}}
358+
frameborder="0"
359+
loading="lazy"
360+
webkitAllowFullScreen
361+
mozAllowFullScreen
362+
allowFullScreen
363+
allow="clipboard-write">
364+
</iframe>
365+
</div>
366+
<p></p>
367+
368+
</p>
369+
</details>
370+
371+
<details>
372+
<summary>
373+
Why do I see the error `[cloud_firestore/permission-denied] Missing or insufficient permissions on screen`?
374+
</summary>
375+
376+
<p>
377+
378+
379+
![missing-permission.avif](imgs/missing-permission.avif)
380+
381+
This error occurs when your app tries to read or write data in the Firestore Database without the correct security rules in place.
382+
383+
To fix this:
384+
385+
- **Redeploy rules:** Go to the Firebase panel in Dreamflow and [**redeploy**](#4-deploy-to-firebase) your Firestore security rules.
386+
- **Update rules if needed:** If your current rules are incorrect (e.g., don’t match your app’s data model or intended access control), you need to update them. You can edit the rules manually in the `firestore.rules` file or update them using the Dreamflow Agent, and then [**redeploy**](#4-deploy-to-firebase) to apply the changes.
387+
388+
Once the correct rules are applied, the error should no longer appear when adding or retrieving data.
389+
</p>
390+
</details>
123 KB
Binary file not shown.
21.5 KB
Binary file not shown.
29.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)