Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get firebase functions instance id?

As I understand, firebase functions execute in the Google Functions Execution Environment.

This means that functions are executed in a single instance. According to this document:

A new function instance is only started in two cases:

  1. When you deploy your function
  2. When a new function instance is automatically created to scale up to the load, or occasionally to replace an existing instance.

My question is:

Is it possible to get this instance id, inside firebase functions?

like image 332
DauleDK Avatar asked May 25 '18 06:05

DauleDK


People also ask

What is instance ID in Firebase?

Firebase Instance ID provides a unique identifier for each app instance and a mechanism to authenticate and authorize actions (example: sending FCM messages). Instance ID is stable except when: App deletes Instance ID. App is restored on a new device. User uninstalls/reinstall the app.

How can I get device ID in Firebase?

In a nutshell: Call FirebaseInstanceId. getInstance(). getToken() to reveive the current device token.

What is the instance ID?

An instance ID is a string reported by a device's enumerator (its bus driver) and distinguishes a device from other devices of the same type on a computer. An instance ID contains serial number information, if supported by the underlying bus, or some kind of location information.

How do I get Firebase instance ID in flutter?

To retrieve the FirebaseInstanceId you need to implement the Firebase In-App messaging SDK and make sure your app connects to Firebase. Once the app is connected to Firebase it will add the FirebaseInstanceId to the Android log once the App is run.


1 Answers

There is no formally exposed instance ID. Normally it would not matter which instance is running your code, and your code shouldn't depend on running in a particular instance

If you need to tag a particular instance for some reason, you could generate your own UUID and store it in a global variable.

like image 145
Doug Stevenson Avatar answered Oct 23 '22 10:10

Doug Stevenson