rowyio / rowy

Low-code backend platform. Manage database on spreadsheet-like UI and build cloud functions workflows in JS/TS, all in your browser.
http://rowy.io
Other
5.94k stars 478 forks source link

Rowy Functions service account #1041

Closed Shakahs closed 1 year ago

Shakahs commented 1 year ago

Describe the bug When building a function self-hosted Rowy tries to invoke a rowy-functions service account, but that service account is not documented in the setup instructions so the build fails.

To Reproduce Steps to reproduce the behavior:

  1. Use self-hosted Rowy
  2. Try to create a derived column
  3. The function build will fail

Expected behavior Rowy should provide documentation for setting up the rowy-functions service account.

Screenshots Rowy Log:

i  deploying functions
⚠  functions: package.json indicates an outdated version of firebase-functions.
Please upgrade using npm install --save firebase-functions@latest in your functions directory.
⚠  functions: Please note that there will be breaking changes when you upgrade.
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  functions: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing . directory for uploading...
i  functions: packaged . (61.93 KB) for uploading
✔  functions: . folder uploaded successfully
i  functions: creating Node.js 16 function R-Sessions(us-central1)...
⚠  functions: failed to create function projects/roga-stage---testing/locations/us-central1/functions/R-Sessions

Functions deploy had errors with the following functions:
    R-Sessions(us-central1)
i  functions: cleaning up build files...

Error: There was an error deploying functions
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

24

19:49:56:56  

command: cd build/functionBuilder/builds/1672285734809; yarn deploy --project roga-stage---testing --only functions

stderr: error Command failed with exit code 2.

GCP Log:

status: {
code: 3
message: "Invalid function service account requested: rowy-functions@roga-stage---testing.iam.gserviceaccount.com. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation."
}
}

Rowy Run version Rowy Run v1.6.4

Shakahs commented 1 year ago

The derivative function deploys and executes normally if I copy the IAM changes from managed Rowy, so this is purely a documentation issue.

Create service account rowy-functions with these permissions: BigQuery Admin Cloud Datastore User Firebase Cloud Messaging API Admin Logs Writer Secret Manager Secret Accessor Storage Object Admin

And rowy-backend needs this IAM grant to use the service account gcloud iam service-accounts add-iam-policy-binding rowy-functions@YOURPROJECT.iam.gserviceaccount.com --member serviceAccount:rowy-backend@YOURPROJECT.iam.gserviceaccount.com --role roles/iam.serviceAccountUser

chwan1 commented 1 year ago

I can confirms this works. Thanks @Shakahs!

harinij commented 1 year ago

Documentation is now improved.