Coder1224 Coder1224 - 2 years ago 77
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()



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