Is there any way to access a unique identifier of the Goodle Cloud Function's current instance inside the function? When I check the function logs I can see there is an identifier to each instance. I would like to access this identifier inside the function while it is running. My intention to create unique folders with some content in one of my storage bucket after each invoked function. Besides being unique folders it would be also great that I can map those easyly with the function which created it.
I think what you're observing is not an "instance ID" and more like the event ID assigned by the event provider. The second argument passed to every background function invocation is a context object that contains the event ID. The purpose of this ID is to help you write functions that are idempotent. They are not really intended to be universally unique.
I suggest that you just generate your own UUID using whatever standard library is available for the language you're using. The chance of two UUIDs colliding is astronomically small, and you are guaranteed a "form" for that value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With