Environment
- Operating System: Ubuntu 14.04 LTS
- Firebase SDK: 5.11.0
- Library: 1.0.0
- Firebase Product: SDK / Cloud Functions
Problem
After upgrading to Firebase Functions 1.0.0 as described in the migration guide, and migrating the way admin.initializeApp() is called, the project no longer deploys correctly.
Seems that the following error is thrown from loadOptionsFromEnvVar() method, which tries to read from process.env[exports.FIREBASE_CONFIG_VAR] and, AFAIK, is not defined.
Steps to Reproduce:
Running npm run deploy from a clean project setup:
alix@Spin7:~/firebase-test/functions$ npm run deploy
> functions@ deploy /home/alix/firebase-test/functions
> firebase deploy --only functions
=== Deploying to 'firebase-test'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint /home/alix/firebase-test/functions
> tslint --project tsconfig.json
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build /home/alix/firebase-test/functions
> tsc
✔ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
Error: Failed to parse app options file: Error: ENOENT: no such file or directory, open '[object Object]'
at FirebaseAppError.FirebaseError [as constructor] (/home/alix/firebase-test/functions/node_modules/firebase-admin/lib/utils/error.js:39:28)
at FirebaseAppError.PrefixedFirebaseError [as constructor] (/home/alix/firebase-test/functions/node_modules/firebase-admin/lib/utils/error.js:85:28)
at new FirebaseAppError (/home/alix/firebase-test/functions/node_modules/firebase-admin/lib/utils/error.js:119:28)
at FirebaseNamespaceInternals.loadOptionsFromEnvVar (/home/alix/firebase-test/functions/node_modules/firebase-admin/lib/firebase-namespace.js:214:19)
at FirebaseNamespaceInternals.initializeApp (/home/alix/firebase-test/functions/node_modules/firebase-admin/lib/firebase-namespace.js:64:28)
at FirebaseNamespace.initializeApp (/home/alix/firebase-test/functions/node_modules/firebase-admin/lib/firebase-namespace.js:362:30)
at Object.<anonymous> (/home/alix/firebase-test/functions/lib/index.js:5:7)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
Having trouble? Try firebase deploy --help
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ deploy: `firebase deploy --only functions`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/alix/.npm/_logs/2018-04-06T09_46_33_752Z-debug.log
Relevant Code:
import * as admin from 'firebase-admin';
import * as functions from 'firebase-functions';
admin.initializeApp();
export const helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
Environment
Problem
After upgrading to Firebase Functions 1.0.0 as described in the migration guide, and migrating the way
admin.initializeApp()is called, the project no longer deploys correctly.Seems that the following error is thrown from
loadOptionsFromEnvVar()method, which tries to read fromprocess.env[exports.FIREBASE_CONFIG_VAR]and, AFAIK, is not defined.Steps to Reproduce:
Running
npm run deployfrom a clean project setup:Relevant Code: