12

I'm using Firebase Functions JavaScript version, and when I run firebase deploy, I'm getting this error:

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

This is my index.js code up until the line which causes this error:

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


var serviceAccount = require("../functions/file.json");

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: "https://app.firebaseio.com"
});

var config = {
    apiKey: "key",
    authDomain: "app.firebaseapp.com",
    databaseURL: "https://app.firebaseio.com",
    projectId: "appID",
    storageBucket: "app.appspot.com",
    messagingSenderId: "number"
};

firebase.initializeApp(config);
admin.initializeApp(functions.config().firebase);

My Node version - 8.11.1

NPM - 5.6.0

3 Answers 3

17

It's a bug in [email protected]. Fixed in 3.18.2.

Run: npm install -g firebase-tools@latest

Sign up to request clarification or add additional context in comments.

5 Comments

again with this issue "firebase-admin": "~6.0.0", "firebase-functions": "^2.1.0",
@LukeCarelsen did you fix your issue somehow?
@AinisSK i cant remember... i dont think so try 3.18.2 like suggested above. sorry :P
For me, it was that I had forgotten to change a function from firestore to database.
0

try to run this

npm i --save firebase-functions@latest

2 Comments

Add explanation to why this will solve the problem.
@sziraqui It's a bug inside old version so update to the latest should fix this problem
-1

in my case, the file .runtimeconfig.json was not valid JSON because of a trailing comma. So it didnt work with no clue about invalid JSON. I was just lucky to find it.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.