- 
                Notifications
    You must be signed in to change notification settings 
- Fork 218
Description
[REQUIRED] Step 2: Describe your environment
- Operating System version: Linux 7u 5.3.0-24-generic Updating README firebase-admin-node#26-Ubuntu SMP Thu Nov 14 01:33:18 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Firebase SDK version: 7.10.0
- Firebase Product: firebase-functions/firebase-admin
- Node.js version: nodejs10 runtime
- NPM version: 6.13.1
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
Relevant Code:
I was trying to adopt https://firebase.google.com/docs/functions/config-env#automatically_populated_environment_variables.
Deploying firebase function (http) with:
if (process.env.FIREBASE_CONFIG === undefined) {
    throw new Error('Missing FIREBASE_CONFIG');
}
...
admin.initializeApp(opts);makes deployment to fail.
From terminal:
$ firebase deploy --only functions:admin.forceRcUpdate
✔ scheduler: all necessary APIs are enabled
⚠ functions[admin-forceRcUpdate(us-central1)]: Deployment error.
Error setting up the execution environment for your function. Please try deploying again after a few minutes.
In logs:
E 2019-12-16T07:16:02.599384474Z admin-forceRcUpdate Error: function terminated. Recommended action: inspect logs for termination reason. Function cannot be initialized.
admin-forceRcUpdate
A 2019-12-16T07:15:58.840Z admin-forceRcUpdate Could not load the function, shutting down. admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Object. (/srv/node_modules/@google-cloud/functions-framework/build/src/index.js:67:33) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Object.getUserFunction (/srv/node_modules/@google-cloud/functions-framework/build/src/invoker.js:57:32) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at require (internal/modules/cjs/helpers.js:22:18) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Module.require (internal/modules/cjs/loader.js:637:17) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Function.Module._load (internal/modules/cjs/loader.js:531:3) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at tryModuleLoad (internal/modules/cjs/loader.js:539:12) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Module.load (internal/modules/cjs/loader.js:600:32) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Module._compile (internal/modules/cjs/loader.js:701:30) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate at Object. (/srv/functions/src/index.ts:12:11) admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate Detailed stack trace: Error: Missing FIREBASE_CONFIG admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate Is there a syntax error in your code? admin-forceRcUpdate
A 2019-12-16T07:15:58.837Z admin-forceRcUpdate Provided module can't be loaded. admin-forceRcUpdate
Removing access to process.env.FIREBASE_CONFIG fixes the issue.
Local emulator works well with it