FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
130 stars 26 forks source link

deploy Stripe is failing #4868

Closed dcook-tepia closed 6 days ago

dcook-tepia commented 1 week ago

Can we access your project?

Current Behavior

Attempting to deploy stripe in FF and its erroring out. FF error says only "Firebase functions not deployed for stripe payments." Firebase Functions says only "Deployment failed" Google Cloud provides the following error: "Here is the log entry: {"logName":"projects/refer-a-friend-mobile-app/logs/cloudaudit.googleapis.com%2Factivity","resource":{"type":"cloud_function","labels":{"region":"us-central1","function_name":"initStripePayment","project_id":"refer-a-friend-mobile-app"}},"payload":"protoPayload","jsonPayload":null,"protoPayload":{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"Build failed: failed to Fetch: failed to download archive gs://gcf-sources-978679615639-us-central1/initStripePayment-e79bca09-2c20-4e03-8832-f5253855d7a7/version-1/function-source.zip: Access to bucket gcf-sources-978679615639-us-central1 denied. You must grant Storage Object Viewer permission to 978679615639-compute@developer.gserviceaccount.com. If you are using VPC Service Controls, you must also grant it access to your service perimeter.\n"},"authenticationInfo":{},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.CreateFunction","resourceName":"projects/refer-a-friend-mobile-app/locations/us-central1/functions/initStripePayment"},"textPayload":null,"timestamp":"2024-11-07T18:33:56.571429Z","receiveTimestamp":"2024-11-07T18:33:57.172355562Z","severity":"ERROR","insertId":"opo554d22bc","httpRequest":null,"labels":{},"operation":{"id":"operations/cmVmZXItYS1mcmllbmQtbW9iaWxlLWFwcC91cy1jZW50cmFsMS9pbml0U3RyaXBlUGF5bWVudC9paERWQUFUbFBMYw","producer":"cloudfunctions.googleapis.com","first":false,"last":true},"traceSampled":false,"sourceLocation":null,"receiveLocation":"us-central1","split":null}"

Expected Behavior

Stripe Deploy should successfully create functions in Firebase/GCP and enable the use of Stripe in a project.

Steps to Reproduce

  1. Go to Settings
  2. go to Stripe
  3. enable stripe payments
  4. enter the publishable key, the secret key, merchant name, and merchant country from Stripe
  5. click the "deploy" button

Reproducible from Blank

Bug Report Code (Required)

none available since we are in "settings"

Visual documentation

Screenshot 2024-11-07 at 11 39 22 AM

Environment

- FlutterFlow version: FlutterFlow v5.0.8+ released October 30, 2024
Flutter version is 3.24.2
- Platform: 
- Browser name and version:
- Operating system and version affected:

Additional Information

Unable to setup Stripe integration We suspect that with GCPs recent security changes that have affected us in multiple other ways they may have clamped down on the security for the deploy functions script.

GEMINI provided the following advice - The log entry indicates that the deployment of the Cloud Function "initStripePayment" failed due to an access denied error when attempting to download the function source code from the Cloud Storage bucket "gcf-sources-978679615639-us-central1". This could be due to several reasons, including:

Missing Storage Object Viewer permission: The service account used by Cloud Functions ( 978679615639-compute@developer.gserviceaccount.com ) might not have the necessary permission to access the Cloud Storage bucket.

VPC Service Controls restriction: If VPC Service Controls are configured, the service account might be blocked from accessing the bucket due to a restrictive service perimeter.

Incorrect bucket name or path: The log entry indicates the function source code is expected to be located at "gs://gcf-sources-978679615639-us-central1/initStripePayment-e79bca09-2c20-4e03-8832-f5253855d7a7/version-1/function-source.zip". Verify that the bucket name and path are correct.

Show less

To validate the root cause, check the following:

Verify Storage Object Viewer permission: Go to the Cloud Storage bucket's IAM page and ensure that the service account " 978679615639-compute@developer.gserviceaccount.com " has the Storage Object Viewer role.

Review VPC Service Controls: If VPC Service Controls are enabled, check the service perimeter configuration to ensure that the service account has access to the Cloud Storage bucket.

Confirm bucket name and path: Double-check the bucket name and path specified in the log entry and ensure they are correct.

+++++ I used these directions to add the Storage Object Viewer role to the default service account

Here's how to add the Storage Object Viewer role to the service account " 978679615639-compute@developer.gserviceaccount.com ":

Using the Google Cloud Console:

Navigate to IAM & Admin: In the Google Cloud Console, go to the "IAM & Admin" section.

Select IAM: Click on "IAM" from the left-hand menu.

Add Member: Click the "Add" button (looks like a person with a plus sign).

Enter Service Account: In the "New principals" field, paste the service account email: " 978679615639-compute@developer.gserviceaccount.com ".

Select Role: In the "Select a role" field, choose "Cloud Storage" and then "Storage Object Viewer".

Save: Click "Save" to apply the changes.

Still no joy!

Alezanello commented 1 week ago

Hello!

This appears to be a project-specific issue and seems more like a support request rather than a reproducible bug. In such cases, the best course of action is to reach out to our support team via the in-app chat or by emailing support@flutterflow.io. They will be happy to assist you with this issue. Additionally, you can refer to our documentation on Stripe integration here: Stripe Documentation. At the bottom, you'll find guidance on handling similar errors.

image.png

Thank you!

dcook-tepia commented 1 week ago

I resolved this issue. Yay! I went to the GCP console and opened the failed function (initStripePayment) in Cloud Run Functions and clicked the option to edit and redeploy. I hit next through the edit functions and when I hit redeploy I was presented with the error message "You need to grant the following roles to the build service account to deploy a function for 978679615639-compute@developer.gserviceaccount.com: • roles/cloudbuild.builds.builder on refer-a-friend-mobile-app

I clicked "Grant All" and the script finished successfully. I then repeated the steps for initStripeTestPayment as well. Then I returned to FlutterFlow and re-ran deploy from the stripe settings page and it deployed successfully

Alezanello commented 6 days ago

I’m glad everything is working as expected now! I’ll go ahead and close this issue, but if you encounter anything else, please don’t hesitate to open a new one!