Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export 'SDK_VERSION' was not found in 'firebase/app' #2071

Closed
xiongemi opened this issue May 13, 2019 · 12 comments
Closed

export 'SDK_VERSION' was not found in 'firebase/app' #2071

xiongemi opened this issue May 13, 2019 · 12 comments

Comments

@xiongemi
Copy link

Version info

Angular:
7.2.13

Firebase:
5.10.0

AngularFire:
5.1.2

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

when run the the build, i got this warning:
WARNING in ./node_modules/@angular/fire/firestore/firestore.js 23:50-61
"export 'SDK_VERSION' was not found in 'firebase/app'
@ ./node_modules/@angular/fire/firestore/public_api.js
@ ./node_modules/@angular/fire/firestore/index.js
@ ./dist/server/main.js
@ ./server.ts

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

Steps to set up and reproduce

Sample data and security rules

<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->

Debug output

** Errors in the JavaScript console **

** Output from firebase.database().enableLogging(true); **

** Screenshots **

Expected behavior

Actual behavior

@emanuel-virca
Copy link

I had to downgrade "@angular/fire": "5.1.1" to get it working

@emanuel-virca
Copy link

emanuel-virca commented May 21, 2019

For ones dealing with this error when running SSR build, I manage to bypass the error by temporary adding the following section in webpack.server.config.js:

module.exports = {
...
 resolve: {
    alias: {
      ['firebase/app']: path.resolve(__dirname, 'node_modules/firebase/app/dist/index.cjs.js')
    }
  }
...
}

Credit goes to @Feiyang1 on his solution

@stot3
Copy link

stot3 commented May 21, 2019

The solution did not work for me, although there are no build errors, after the build other errors come up. I do not know if the workaround is exactly targeting what is wrong. These are the errors that come up with the workaround implemented using @angular/fire@5.1.3 and firebase@6.0.2
Screen Shot 2019-05-21 at 11 15 30 AM
Screen Shot 2019-05-21 at 10 52 24 AM

@emanuel-virca
Copy link

@stot3 Yes you are right, it happens to me also, but I guess it is a different issue.

@davideast
Copy link
Member

davideast commented May 22, 2019

Hey everyone. This is not specifically an AngularFire issue, so please check out the official repo for more info: https://github.com/firebase/firebase-js-sdk

@xiongemi
Copy link
Author

@davideast I could not access the link you provided: https://github.com/FirebasePrivate/firebase-js-sdk

@inorganik
Copy link

inorganik commented May 28, 2019

Hey @davideast, I believe this is a legit issue and it originates inside this repo. In node_modules I can see the source of the error in @angular/fire/firestore/firestore.js - the following lines were added recently that weren't there in v5.1.1:

import { SDK_VERSION } from 'firebase/app';
...
var major = parseInt(SDK_VERSION.split('.')[0]);
var minor = parseInt(SDK_VERSION.split('.')[1]);

The warning says SDK_VERSION is not exported by firebase/app:

WARNING in ./node_modules/@angular/fire/firestore/firestore.js 23:21-32
"export 'SDK_VERSION' was not found in 'firebase/app'
@ ./node_modules/@angular/fire/firestore/public_api.js
@ ./node_modules/@angular/fire/firestore/index.js
@ ./dist/server/main.js
@ ./server.ts

So when you try to run npm run serve:ssr it throws an error:

var major = parseInt(firebase_app__WEBPACK_IMPORTED_MODULE_6__["SDK_VERSION"].split('.')[0]);
                                                                              
TypeError: Cannot read property 'split' of undefined

Can you please look into it? This seems to be a broken release, at least for doing Universal.

@davideast
Copy link
Member

@xiongemi Sorry! Wrong repo. Here's the real deal: https://github.com/firebase/firebase-js-sdk

@davideast
Copy link
Member

@inorganik Thanks for pinning that down. I was assuming this was an export of the js-sdk, and I was totally wrong.

@jamesdaniels It appears the version check is breaking things on Universal. Let's dig later.

@Yash-Jais
Copy link

I am also facing the same issue please help me out.
I am using Angular 7,
Firebase V5.10.0,
angularfire2 V5.1
and angular/fire 5.1.1

@madmacc
Copy link

madmacc commented Jan 16, 2024

I'm getting this issue in an Angular 14 project.
firebase 9.22.1
@angular/fire 7.6.1

Not sure what is causing it as these versions work fine in another Angular 16 project. Not using any universal features.

UPDATE:
I got this working by changing versions to:
"firebase": 9.0.2
"@angular/fire": 7.4.1

image

@ocamposoy
Copy link

I'm getting this issue in an Angular 14 project. firebase 9.22.1 @angular/fire 7.6.1

Not sure what is causing it as these versions work fine in another Angular 16 project. Not using any universal features.

UPDATE: I got this working by changing versions to: "firebase": 9.0.2 "@angular/fire": 7.4.1

image

if you solved this problem, can you share the solution please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants