serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
271 stars 127 forks source link

Add support for Database events #86

Open fantapop opened 6 years ago

fantapop commented 6 years ago

It would be great if this supported firebase real time db triggers:

https://firebase.google.com/docs/reference/functions/functions.database

marianofino commented 5 years ago

Hello @fantapop For triggering a function whenever it creates new data in realtime database, you should write something like this in the serverless.yml file:

myFunction:
  handler: myFunction
  events:
    - event:
        eventType: providers/cloud.firestore/eventTypes/document.update
        resource: projects/<project-id>/databases/(default)/documents/<path-to-document>

As I pointed out here, I wrote an article about it: https://medium.com/ponce-agtech/using-firebase-triggers-in-serverless-framework-ad99594b86fa

fantapop commented 5 years ago

Awesome thank you!

On Wed, Apr 3, 2019 at 5:47 PM Mariano Finochietto notifications@github.com wrote:

Hello @fantapop https://github.com/fantapop For triggering a function whenever it creates new data in realtime database, you should write something like this in the serverless.yml file:

myFunction: handler: myFunction events:

  • event: eventType: providers/cloud.firestore/eventTypes/document.update resource: projects//databases/(default)/documents/

As I pointed out here https://github.com/serverless/serverless-google-cloudfunctions/issues/146#issuecomment-479707759, I wrote an article about it: https://medium.com/ponce-agtech/using-firebase-triggers-in-serverless-framework-ad99594b86fa

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/serverless/serverless-google-cloudfunctions/issues/86#issuecomment-479708385, or mute the thread https://github.com/notifications/unsubscribe-auth/AGWbqHvOacZ40blpsEKWNwSWZ8pNteBnks5vdUuWgaJpZM4P2eKe .