How to get Firebase Project Name or ID from Cloud Function

后端 未结 6 1401
别跟我提以往
别跟我提以往 2021-01-01 12:25

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 thin

6条回答
  •  轮回少年
    2021-01-01 13:05

    Firebase admin SDK has access to that information for you.

    const admin = require('firebase-admin');
    const projectId = admin.instanceId().app.options.projectId
    

提交回复
热议问题