Functions-samples: TypeError: firebase.initializeApp is not a function [Getting error both at local and in deployed]

Created on 10 Nov 2018  Â·  6Comments  Â·  Source: firebase/functions-samples

TypeError: firebase.initializeApp is not a function
at Object. (........../isomorphic-react-app/functions/build/server.bundle.js:40580:10)
at __webpack_require__ (........./isomorphic-react-app/functions/build/server.bundle.js:21:30)
at Object.module.exports.module.exports.status (........../isomorphic-react-app/functions/build/server.bundle.js:22825:76)
at __webpack_require__ (........./isomorphic-react-app/functions/build/server.bundle.js:21:30)
at Object.module.exports.exports.__esModule (......./isomorphic-react-app/functions/build/server.bundle.js:40944:63)
at __webpack_require__ (......./isomorphic-react-app/functions/build/server.bundle.js:21:30)
at ......./isomorphic-react-app/functions/build/server.bundle.js:67:18
at Object. (......./isomorphic-react-app/functions/build/server.bundle.js:70:10)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)

Most helpful comment

I'm using Firebase 6.0.1, the ES import statement import firebase from 'firebase/app'; works for me,
but the one in the instruction import * as firebase from "firebase/app"; does not. Please update.

All 6 comments

+1 this appears for isomorphic-react-app when you do firebase serve --only hosting,functions

This seems to happen for me on the default (Node-8) branch, but not on master — it seems using an older version of the firebase package does the trick: 4.x works, 5.x does not.
Perhaps an automated process (@dpebot) upgraded things without testing?

This is still happening. Please provide a fix for this. It happens even wehn you try to deploy to firebase

I'm using Firebase 6.0.1, the ES import statement import firebase from 'firebase/app'; works for me,
but the one in the instruction import * as firebase from "firebase/app"; does not. Please update.

Just want to follow up on this as I'm having the exact same error in a gatsby app when using this with gatsby-plugin-layout. Following @tanbt 's solution fixes the issue, but gives plenty of warnings. I might look into this a bit later on.

I'm using Firebase 6.0.1, the ES import statement import firebase from 'firebase/app'; works for me,
but the one in the instruction import * as firebase from "firebase/app"; does not. Please update.

I'm using Firebase 6.0.1, the ES import statement import firebase from 'firebase/app'; works for me,
but the one in the instruction import * as firebase from "firebase/app"; does not. Please update.

Thanks! I was also stuck at this error. importing firebase without * works xD

Was this page helpful?
0 / 5 - 0 ratings

Related issues

palimad picture palimad  Â·  3Comments

Midhilaj picture Midhilaj  Â·  5Comments

rodrigoreal picture rodrigoreal  Â·  5Comments

nhathiwala picture nhathiwala  Â·  4Comments

Qzingo picture Qzingo  Â·  3Comments