Angular 5 + Firebase: Namespace 'firebase.auth' has no exported member 'IdTokenResult' - firebase

I am currently work on web project using Angular 5 and I want to integrate the Firebase Cloud Messaging to send notification on app, bt I faced to a lot of problems that I tried to fix them. Right now there two errors that I'm not able to fix concerning: Namespace 'firebase.auth' and functions
The errors look like:
ERROR in node_modules/angularfire2/auth/auth.d.ts(12,45): error TS2694: Namespace 'firebase.auth' has no exported member 'IdTokenResult'.
node_modules/angularfire2/firebase.app.module.d.ts(2,42): error TS2305: Module '"/Users/gerardtalla/dev/workspaces/ws-parcaune/pms/pms-frontend-2018/node_modules/firebase/app/index"' has no exported member 'functions'.
How can I fix that? I'm using
Angular 5
"firebase": "4.8.0"
"angularfire2": "^5.0.0-rc.5"
"#angular/cli": "~1.7.3"
if someone has an idea do not hesitate please share with me. Thank a lot in advance.

just use "angularfire2": "5.0.0-rc.5" instead of "angularfire2": "^5.0.0-rc.5"

Run the following command:
npm i --save firebase#latest angularfire2#latest

It is version compatible issue, you can read
AngularFirebase2 Changelog
5.0.0-rc.9 (2018-05-16)
auth: Adding user and idTokenResult Observables to AngularFireAuth (#1642) (31045a9)

"angularfire2": "5.0.0-rc.6",
"firebase": "4.9.0",
I resolve this issue by making this change in package.json.

mostly it is the version problem
make this change in package.json
"angularfire2": "5.0.0-rc.6",
"firebase": "4.9.0"
These should solve the problem

I fixed it with this.
"firebase": "^5.7.0",
"angularfire2": "5.0.0-rc.6",

I got the same error, remove folder in node_modules and reinstall firebase fixed my problem.
npm install --save firebase
mostly it is the version problem, check version using npm list, or try downgrade to the following the error should gone
angular: 4
angularfire2: "^5.0.0-rc.3"
firebase: "4.13.1"

Try this out
npm install --save firebase #angular/fire -f

Related

React-Native GoogleSignin.SIGN_IN_CANCELLED

I working with react-native firebase sign in with Google from this package here:
https://github.com/react-native-google-signin/google-signin#project-setup-and-initialization
using: yarn add #react-native-google-signin/google-signin
It works perfectly on Android logging me in as desired however it is not working at all on iOS and have come accross the following error
ERROR TypeError: null is not an object (evaluating 'RNGoogleSignin.SIGN_IN_CANCELLED')
I cannot understand why this is happening on iOS but not android:
process:
1. yarn add #react-native-google-signin/google-signin
2. cd ios
3. pod install
- I have updated the GoogleService-Info.plist
- I have the enabled "sign in with Apple"
- The URL types have been update with reverse ID
Any help is welcome!
Just managed to solve this issue by changing the package number from
"#react-native-google-signin/google-signin": "^8.0.0",
to this:
"#react-native-google-signin/google-signin": "7.2.2",
hope this helps anyone who needs it!

react-native-firebase_messaging has not defined a default in project.ext.'react-native'.versions.android.compileSdk

I'm using #react-native-firebase/messaging. when I tried to run the project in android it's return error
:react-native-firebase_messaging has not defined a default in project.ext.'react-native'.versions.android.compileSdk in its build.gradle file.
I've found a solution to this issue. I'm using #react-native-firebase/messaging with firebase Auth and realtime database. this issue produces because of the version.
So, I've removed all firebase libraries and reinstall it and it's working now
I was also getting similar error for crashlytics-
* What went wrong:
A problem occurred evaluating project ':react-native-firebase_crashlytics'.
> :react-native-firebase_crashlytics has not defined a default in project.ext.'react-native'.versions.android.compileSdk in its build.gradle file.
I was using "#react-native-firebase/crashlytics": "8.4.5", downgrading it to "#react-native-firebase/crashlytics": "8.2.1" worked for me.
upgrading all the firebase dependencies worked for me
this works on my project:
I use "#react-native-firebase/messaging": "^7.4.2"
I changed the file node_modules/#react-native-firebase/messaging/android/build.gradle
minSdk : 16,
targetSdk : 28,
compileSdk: 28,
buildTools: "28.0.3"
Never downgrade your packages! You should be always up-to-date!
My problem was that I installed a part of #react-native-firebase/{package}s and after a couple of months later I installed another part of that {package}s.
The solution is to install all these (or whose which you need) packages at the same time:
npm install --save #react-native-firebase/app #react-native-firebase/auth #react-native-firebase/database #react-native-firebase/firestore #react-native-firebase/messaging #react-native-firebase/storage
This works on my project
I run npx jetify on my project root folder

Cannot serve firebase cloud function locally

I'm getting an error in express-serve-static core when trying to build my firebase cloud function locally.
How do I fix this?
I've tried reinstalling the node packages but without luck.
node_modules/#types/express-serve-static-core/index.d.ts:31:10 - error TS2305: Module '"../qs"' has no exported member 'ParsedQs'.
31 import { ParsedQs } from "qs";
You can fix this by installing #types/qs.
npm i #types/qs#6.9.3
Try to return to #types/express-serve-static-core#4.17.5 (instead of the latest 4.17.7).
If you don't have this package in you dependencies, install it explicitly.
npm install -D #types/express-serve-static-core#4.17.5
I had the same problem and returning to the version 4.17.5 worked for me.

error using moment.js with serverless-bundle

how can I add moment.js locale file to serverless bundle?
Thanks for any help :)
I tried the following:
git clone git#github.com:AnomalyInnovations/serverless-nodejs-starter.git
cd serverless-nodejs-starter
npm i moment
then in file handler.js add
import moment from "moment";
and update hello with just call to moment(); (to avoid lint error)
when running local run:
serverless invoke local --function hello
the error received:
Error: Cannot find module './locale'
There seems to be an issue with the latest version of momentjs as you can see in this Github Issue. You can try the following:
npm install --save moment#2.24.0
Add a resolutions block in your package.json file as such:
"resolutions": {
"moment": "2.24.0"
}

ERROR: Project with path ':#react-native-firebase_app' could not be found in project ':#react-native-firebase_auth'

After install react-native-firebase and add module auth, showed this erro in Android Studio:
ERROR: Project with path ':#react-native-firebase_app' could not be
found in project ':#react-native-firebase_auth'.
What does this mean?
I have also faced the same issue.
After I install npm i #react-native-firebase/app the problem is solved.
You can try the following:
-Checking if firebase app was referenced in an incorrect way in MainApplication.java.
-Remove the modules and re-installing them may fix the problem sometimes.
I think you have different versions of firebase/app and firebase/auth.
Just go in 'node module/#react-native-firebase' directory and check package json of both firebase/app and firebase/auth you will see different version.
This problem can also happen if you are using #react-native-firebase#6.2.0
if you check the build.gradle of firebase/auth in version 6.2.0
dependencies {
api project(':#react-native-firebase_app')
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
implementation "com.google.firebase:firebase-auth"
}
So here is a problem that it is not able to find #firebase/app
and #firebase/auth depends on #firebase/app
And in #6.3.4 which is working fine for me have build.gradle of #firebase/auth like below
so it is able to find #firebase/app
if (findProject(':#react-native-firebase_app')) {
api project(':#react-native-firebase_app')
} else if (findProject(':react-native-firebase_app')) {
api project(':react-native-firebase_app')
} else {
throw new GradleException('Could not find the react-native-firebase/app package, have you installed it?')
}
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
implementation "com.google.firebase:firebase-auth"
}
run npm uni #react-native-firebase/auth
then run this simple command #react-native-firebase/auth#10.4.1
I was using "#react-native-firebase/auth": "15.1.1", and having the same problem , then i downgrade it to "#react-native-firebase/auth": "^10.4.1", and it worked.
if you have any problem installing make sure to use --legacy-peer-deps at the end , like this:
npm i #react-native-firebase/auth#10.4.1 --legacy-peer-deps

Resources