Coder1224 Coder1224 - 1 year ago 58
Javascript Question

How to get Firebase Project Name or ID from Cloud Function

I am using Cloud Functions and want to get the project name from within one of my Javascript server files. I know that value is stored in the .firebaserc, but I don't think that file is available on the server, right? I want to do something like this:

const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.getProjectName(); // or getProjectID()


or

functions.getProjectName();

Answer Source

Thank you @Frank. The answer is: process.env.GCLOUD_PROJECT.
I'm not sure where the variable process comes from, but this does work to get the project name.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download