Skip to content

Commit 9bc4db9

Browse files
committed
improved formatting, updated content
1 parent b943bc9 commit 9bc4db9

File tree

2 files changed

+96
-93
lines changed

2 files changed

+96
-93
lines changed

docs/troubleshooting/cloud-functions-issues/cloud_functions_troubleshooting.md

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,68 +3,63 @@ keywords: ['deployment', 'error', 'cloud']
33
slug: /cloud-functions-troubleshooting
44
title: Cloud Functions Troubleshooting
55
---
6-
# Cloud Functions Troubleshooting
7-
8-
## Introduction
9-
10-
Cloud Functions are a powerful feature in FlutterFlow, allowing developers to execute backend code in response to events triggered by Firebase features and HTTPS requests. This guide provides troubleshooting tips for common issues you might encounter when working with Cloud Functions in FlutterFlow.
116

12-
## Error 1: Function Deployment Errors
13-
14-
### Naming Convention
15-
16-
Please ensure that the name of the functions in the code matches the name of the function in the FlutterFlow editor.
7+
# Cloud Functions Troubleshooting
178

18-
![](../assets/20250430121133833159.png)
9+
Cloud Functions allow you to execute backend code in response to events triggered by Firebase features or HTTPS requests. This article covers common issues you might encounter when using Cloud Functions in FlutterFlow and how to resolve them.
1910

20-
As shown in the attached screenshot, the name of the function is '`data`' which is different from the '`logoMaker`' defined for the function name.​
11+
## Deployment Errors
2112

22-
### Syntax Errors
13+
- **Function Name Mismatch**
2314

24-
Check for Syntax Errors: Ensure your Cloud Functions code does not contain syntax errors. Use linting tools or the Firebase CLI to test your functions locally before deployment.
15+
Ensure that the function name in your code exactly matches the function name defined in FlutterFlow.
2516

26-
Ensure Firebase CLI is Updated: Make sure you have the latest version of the Firebase CLI installed. Update it by running `npm install -g firebase-tools` in your terminal.
27-
Validate Firebase Project Configuration: Verify that your FlutterFlow project is linked to the correct Firebase project. Cross-reference the Firebase project ID in FlutterFlow's project settings.
17+
For example, in the screenshot below, the function name in the code is `data`, while FlutterFlow expects `logoMaker`. This mismatch will prevent successful deployment.
2818

29-
## Error 2: Triggering Issues
19+
![](../assets/20250430121133833159.png)
3020

31-
**Event**:
32-
Cloud Functions are not triggered by the intended events.​
21+
- **Syntax Issues**
3322

34-
**Solutions**:
23+
- Check for syntax errors in your Cloud Functions code.
24+
- Use linting tools or the Firebase CLI to test your functions locally before deployment.
25+
- Always validate your Firebase project configuration in FlutterFlow to ensure it's linked to the correct Firebase project ID.
3526

36-
- Review Triggers: Double-check that the event you're using to trigger the Cloud Function is correctly configured. For example, if using a Firestore trigger, ensure the document path is correct.
27+
- **Firebase CLI Version**
3728

38-
- Permissions and Rules: Ensure your Firebase project's permissions and rules allow the operations your Cloud Function tries to perform. Restricted permissions can prevent functions from executing as expected.
29+
Make sure you're using the latest version of the Firebase CLI. You can update it using:
3930

40-
## Error 3: Execution Timeouts
4131

42-
**Event**:
43-
Functions timeout or take too long to execute.
32+
## Trigger Configuration Issues
4433

45-
Please ensure to set the timeout time for the functions set in the project to avoid the default timeout duration for the cloud function defined.
34+
If your Cloud Functions are not triggered as expected:
4635

47-
![](../assets/20250430121134186956.png)
36+
- **Review the Event Triggers:**
37+
- For Firestore triggers, verify that the document path and collection names are correct.
38+
- For HTTP functions, ensure your endpoints are correctly set up in FlutterFlow.
4839

49-
**Solutions**:
40+
- **Check Permissions and Rules:**
41+
- Verify that your Firebase security rules and project permissions allow the operations your Cloud Function performs. Insufficient permissions can block function execution.
5042

51-
You can add the timeout duration for the function to run in the area shown in the highlighted section of the project. Increase the timeout setting in the Cloud Function configuration if the operation naturally takes longer to complete. Keep in mind that longer timeouts may incur higher costs.
43+
## Execution Timeouts
5244

53-
Additionally, you can set up the Cloud Function regions.​
45+
Cloud Functions may fail if they exceed the default timeout duration.
5446

55-
![](../assets/20250430121134509618.png)
47+
- Set a custom timeout duration in FlutterFlow where the function is defined.
5648

57-
## Error 4: Cold Start Issues
49+
![](../assets/20250430121134186956.png)
5850

59-
**​Event**:
60-
Functions take longer to respond after periods of inactivity.
51+
- If your function requires more time for processing, increase the timeout setting in your Cloud Function configuration. Keep in mind that longer timeouts may increase your Firebase costs.
6152

62-
**Solutions**:
53+
- You can also configure the Cloud Function regions in FlutterFlow:
6354

64-
- Keep Functions Warm: Implement a scheduled function (using Cloud Scheduler) to periodically trigger your Cloud Function, reducing the impact of cold starts.
55+
![](../assets/20250430121134509618.png)
6556

66-
- Optimize Dependencies: Reduce the number of dependencies in your Cloud Function, as loading many or large dependencies can increase cold start times.
57+
## Cold Start Delays
6758

59+
Cloud Functions may take longer to respond after periods of inactivity (cold starts).
6860

61+
- **Use Cloud Scheduler** to periodically invoke your functions, keeping them "warm" and reducing cold start times.
62+
- **Optimize dependencies** by reducing the number and size of required packages. Large dependencies increase cold start delays.
6963

7064

65+
Following these steps should help resolve most issues when working with Cloud Functions in FlutterFlow.

docs/troubleshooting/cloud-functions-issues/flutterflow_cloud_functions_troubleshooting_guide.md

Lines changed: 64 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,112 +15,120 @@ This article guides you through common challenges with Cloud Functions in Flutte
1515

1616
Occasionally, you may encounter two specific errors:
1717

18-
`Out of Date (Error)` or `Not Deployed (Error).`
18+
`Out of Date (Error)` or `Not Deployed (Error).`
1919

20-
These errors can arise from a variety of situations. If you're facing these issues, follow this troubleshooting guide designed to help you resolve them.
20+
These errors can arise from a variety of situations. If you're facing these issues, follow this troubleshooting guide designed to help you resolve them.
2121

22-
## Out of Date Error
22+
**Out of Date Error**
2323

24-
![](../assets/20250430121126719355.png)
24+
![](../assets/20250430121126719355.png)
2525

26-
## Not Deployed Error
26+
**Not Deployed Error**
2727

28-
![](../assets/20250430121126936614.png)
28+
![](../assets/20250430121126936614.png)
2929

3030
## Key Checks for Resolving Deployment Errors
3131

32-
Below are essential steps to verify your project is correctly set up for cloud function deployment.
32+
Below are essential steps to verify your project is correctly set up for cloud function deployment.
3333

34-
### 1. Verify [email protected] has all necessary permissions
34+
1. **Verify [email protected] has all necessary permissions**
3535

36-
To ensure FlutterFlow works smoothly with your project, you'll need to adjust some settings in Firebase, a tool we use in the background. Here's how you can do it,
36+
To ensure FlutterFlow works smoothly with your project, you'll need to adjust some settings in Firebase, a tool we use in the background. Here's how you can do it,
3737

38-
First, we need to make sure that an email associated with FlutterFlow, which is **`[email protected]`**, has the right kind of access called `cloud function admin permission` in your Firebase project. This lets FlutterFlow do its job without any hiccups.
38+
First, we need to make sure that an email associated with FlutterFlow, which is **`[email protected]`**, has the right kind of access called `cloud function admin permission` in your Firebase project. This lets FlutterFlow do its job without any hiccups.
3939

40-
Besides the admin permission, we need to add a couple more types of permissions for FlutterFlow. These are called `editor` and `Service account user`.
40+
Besides the admin permission, we need to add a couple more types of permissions for FlutterFlow. These are called `editor` and `Service account user`.
4141

42-
How to Add These Permissions:
42+
**How to Add These Permissions**:
4343

44-
- Go to the Firebase website and log into your account.
44+
- Go to the Firebase website and log into your account.
4545

46-
- Find your project and open Project Settings.
46+
- Find your project and open Project Settings.
4747

48-
- Inside the settings, look for a section named "Users and Permissions." That's where you can manage who has access to your project.
48+
- Inside the settings, look for a section named "Users and Permissions." That's where you can manage who has access to your project.
4949

50-
- You'll find an option for "Advanced Settings Permissions". Click on that. This will open Google Cloud functions, locate **[email protected]** and click on the edit button to add the permissions
50+
- You'll find an option for "Advanced Settings Permissions". Click on that. This will open Google Cloud functions, locate **[email protected]** and click on the edit button to add the permissions
5151

52-
![](../assets/20250430121127218829.png)
52+
![](../assets/20250430121127218829.png)
5353

54-
![](../assets/20250430121127501343.png)
54+
![](../assets/20250430121127501343.png)
5555

56-
### 2. Make sure there are no errors in the custom code for cloud functions
56+
2. **Make sure there are no errors in the custom code for Cloud Functions**
5757

58-
Sometimes, small mistakes in your code can stop your cloud function from being deployed. To avoid this, it's a good idea to double-check your code for any errors before you move forward.
58+
Sometimes, small mistakes in your code can stop your cloud function from being deployed. To avoid this, it's a good idea to double-check your code for any errors before you move forward.
5959

60-
This can be done locally on an IDE of your choice
60+
This can be done locally on an IDE of your choice
6161

62-
![](../assets/20250430121127844921.png)
62+
![](../assets/20250430121127844921.png)
6363

64-
### 3. Make sure the project is on blaze plan on Firebase
64+
3. **Make Sure the Project is on Blaze Plan on Firebase**
6565

66-
If Cloud functions cannot be deployed, be sure to confirm if the project is in blaze plan and not spark plan,
66+
If Cloud functions cannot be deployed, be sure to confirm if the project is in blaze plan and not spark plan,
6767

68-
Additionally, cross-check the logs in the console log. Sometimes, Google Cloud Platform (GCP) sends the log back to inform you that the project is in the Spark plan
68+
Additionally, cross-check the logs in the console log. Sometimes, Google Cloud Platform (GCP) sends the log back to inform you that the project is in the Spark plan
6969

70-
In some cases, even if Firebase shows you're on the Blaze plan, there might be a billing issue on the GCP. Make sure your billing account is active and has yet to expire.
70+
In some cases, even if Firebase shows you're on the Blaze plan, there might be a billing issue on the GCP. Make sure your billing account is active and has yet to expire.
7171

72-
### 4. Check if any other cloud function deployment succeeds (push notification, stripe.)
72+
4. **Check if any other Cloud Function Deployment succeeds (Push Notification, Stripe.)**
7373

74-
If some of your functions are already working as expected, it means your Firebase settings are properly in place. Your next steps should be to examine the settings specific to Cloud Functions and review the code itself for any mistakes or incorrect regional settings.on
74+
If some of your functions are already working as expected, it means your Firebase settings are properly in place. Your next steps should be to examine the settings specific to Cloud Functions and review the code itself for any mistakes or incorrect regional settings.on
7575

76-
### 5. Make sure the region is selected and is not left as [default] - on both advanced Firebase settings and in the cloud function deployment page
76+
5. **Make sure the region is selected and is not left as [default] on both advanced Firebase settings and in the cloud function deployment page**
7777

78-
The region for the cloud function deployment should be set to the region that is set in your Firebase project setting
78+
The region for the cloud function deployment should be set to the region that is set in your Firebase project setting
7979

80-
The region should not be left as default; this region should co-respond with all deployed cloud- functions in the project
80+
The region should not be left as default; this region should co-respond with all deployed cloud- functions in the project
8181

82-
![](../assets/20250430121128170242.png)
82+
![](../assets/20250430121128170242.png)
8383

84-
![](../assets/20250430121128453683.png)
84+
![](../assets/20250430121128453683.png)
8585

86-
In some cases, where you deployed some of the cloud functions in different regions, you will need to delete any that already exist but in the wrong region, modify the region, and then re-deploy again
86+
In some cases, where you deployed some of the cloud functions in different regions, you will need to delete any that already exist but in the wrong region, modify the region, and then re-deploy again
8787

88-
### 6. Different Cloud function protocols (HTTP VS Callable Functions)
88+
6. **Different Cloud Function Protocols (HTTP VS Callable Functions)**
8989

90-
Suppose you had deployed the cloud function as an HTTP function. In that case, if you try to redeploy the same function as a callable function, the deployment will fail, and you will get this error `[makeUserAdmin(us-central1)] Changing from an HTTPS function to a callable function is not allowed. Please delete your function and create a new one instead`.
90+
Suppose you had deployed the cloud function as an HTTP function. In that case, if you try to redeploy the same function as a callable function, the deployment will fail, and you will get this error `[makeUserAdmin(us-central1)] Changing from an HTTPS function to a callable function is not allowed. Please delete your function and create a new one instead`.
9191

92-
To resolve this, you will have to delete the cloud function in the Firebase Cloud function section and then modify the Function in FlutterFlow and re-deploy the function
92+
To resolve this, you will have to delete the cloud function in the Firebase Cloud function section and then modify the Function in FlutterFlow and re-deploy the function
9393

94-
### 7. Verify that the package.json file is not left blank and that it doesn’t have invalid characters
94+
7. **Verify that the package.json file is not left blank and that it doesn’t have invalid characters**
9595

96-
Confirm that you use the generated package.json file, and don’t make any changes to the file unless you are adding the packages.
96+
Confirm that you use the generated package.json file, and don’t make any changes to the file unless you are adding the packages.
9797

98-
If FlutterFlow fails to generate the file details, it is recommended to use this
98+
If FlutterFlow fails to generate the file details, it is recommended to use this
9999

100-
```
101-
{ "name": "functions", "description": "Firebase Custom Cloud Functions", "engines": { "node": "18" }, "main": "index.js", "dependencies": { "firebase-admin": "^11.8.0", "firebase-functions": "^4.3.1" }, "private": true }
102-
```
100+
```js
101+
{
102+
"name": "functions",
103+
"description": "Firebase Custom Cloud Functions",
104+
"engines": {
105+
"node": "18"
106+
},
107+
"main": "index.js",
108+
"dependencies": {
109+
"firebase-admin": "^11.8.0",
110+
"firebase-functions": "^4.3.1"
111+
},
112+
"private": true
113+
}
114+
```
103115

104-
### 8. Ensure that the packages used in the cloud functions are included in the package.json file
116+
8. **Ensure that the packages used in the cloud functions are included in the package.json file**
105117

106-
It's normal to forget to include third packages used in the cloud function in the package.json file. For instance, if you are using `axios`, please ensure that the package is already included in the package.json file
118+
It's normal to forget to include third packages used in the cloud function in the package.json file. For instance, if you are using `axios`, please ensure that the package is already included in the package.json file
107119

108-
![](../assets/20250430121128741407.png)
120+
![](../assets/20250430121128741407.png)
109121

110-
### 9. Cross-check that the version of the third-party library used is valid
122+
9. **Cross-check that the version of the third-party library used is valid**
111123

112-
Check that the version of the third-party library used is valid, i.e., the version listed in the package.json file should be among the versions listed in the package's version archive. See https://www.npmjs.com/package/axios?activeTab=versions
124+
Check that the version of the third-party library used is valid, i.e., the version listed in the package.json file should be among the versions listed in the **[package's version archive](https://www.npmjs.com/package/axios?activeTab=versions)**.
113125

114-
![](../assets/20250430121129014430.png)
126+
![](../assets/20250430121129014430.png)
115127

116-
### 10. Check for un-deployed Firebase rules
128+
10. **Check for un-deployed Firebase rules**
117129

118-
Lastly, ensure that you have deployed your Firebase configuration settings from FlutterFlow. This includes Firestore rules and Firestore indexes.
130+
Lastly, ensure that you have deployed your Firebase configuration settings from FlutterFlow. This includes Firestore rules and Firestore indexes.
119131

120-
These can block cloud function function deployment when they are still not deployed
121-
122-
We hope this guide provides you with the necessary steps to successfully troubleshoot and resolve any issues you encounter with Cloud Functions in FlutterFlow. Remember, careful attention to setup details and adherence to the outlined checks can prevent many common problems.
123-
124-
Should you require further assistance, don't hesitate to consult the FlutterFlow documentation or reach out to our support team. Your success is our priority, and we're here to help you make the most out of FlutterFlow's capabilities. Happy coding!
132+
These can block cloud function function deployment when they are still not deployed
125133

126134

0 commit comments

Comments
 (0)