Facing issue in gen2 google cloud function trigger

194 views
Skip to first unread message

Satender Pal

unread,
Oct 17, 2023, 7:34:09 PM10/17/23
to Firebase Google Group

I wrote a python program a few days ago in which, CSV file is uploaded to a folder in firebase storage, after that my trigger function runs. Which is deployed in Google Cloud Function. Now I have to increase the trigger's time out limit for which I want to deploy that function with gen2.

But whenever I am deploying with gen2 my trigger is not working. While my gen1 trigger with same code is working good.

Please guide me how can I deploy it in gen1 so that the trigger runs.

Joe Spiro

unread,
Oct 17, 2023, 8:20:11 PM10/17/23
to Firebase Google Group
Hello,

How are you currently scoping the trigger for the function? The syntax for triggering  based on buckets/objects  (along with other aspects) has changed between Gen 1 and Gen 2.

Take a look at Scope a Cloud Storage Function to see examples of how to configure them for Gen 2.

What would have poreviously been the following in gen 1:


exports.firstGenGenerateThumbnail = functions.storage.bucket('bucketName').object().onFinalize(async (object) => {
  // ...
});

Is now something more like the following in Gen 2:

onObjectFinalized({ bucket: "bucketName" }, (event) => {
  //…
});

Try writing functions based on the examples in the link and report back.
Reply all
Reply to author
Forward
0 new messages