Cannot serve firebase cloud function locally - firebase

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.

Related

Firebase task function failed to deploy

I havae the following firebase cloud function codes and want to deploy to my project.
exports.bgTask = functions.region(Defs.SERVER_AREA)
.tasks.taskQueue({
retryConfig: {
maxAttempts: 5,
minBackoffSeconds: 60
},
rateLimits: {
maxConcurrentDispatches: 6
},
}).onDispatch(async (data) => {
});
Obviously, the above code just copied from firebase cloud function sample and it can be run under emulator, but when I tried to deploy to server and had no luck.
I tried to run firebase functions:log command and see the following error log.
So, it seems that Firebase cli cannot recognize the taskQueue property.
I googled a lot and had no luck. The following screen shot shows the corresponding library what I am using.
Anyone has any ideas on this?
Thanks in advance!
As mentioned by #Xavier, He managed to fix the issue by creating a new project and initialize Firebase function and deployed successfully by including the packages that are needed and run the command npm install --save firebase-functions#latest for the latest version of Firebase Functions.

Error after page refresh - Error: Package subpath './yup/dist/yup' is not defined by "exports"

I am using yup and react-hook-form for one of my modals, everything works, but when I refresh the page the app crashes and I see this error:
Error: Package subpath './yup/dist/yup' is not defined by "exports" in /Users/rips/Desktop/myapp-next rules/node_modules/#hookform/resolvers/package.json
This error happened while generating the page. Any console logs will be displayed in the terminal window.
these are my imports
import { yupResolver } from "#hookform/resolvers/yup/dist/yup";
import * as yup from "yup";
What could be the issue here?
Try to downgrading the node version.
First install nvm from here.
Then install 16.15.1 (current version is 18.5)
Then use nvm use 16.15.1 and then try to build the project.

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

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

Vuejs2 firebase with electron error

I have configured electron with vuejs and i would like to add firebae to my project so i have
In my main.js
import * as firebase from 'firebase'
let firebasconfig = {
//config from firebase project
};
Vue.prototype.$firebase = firebase.initializeApp(firebasconfig);
But now am getting an error
Error: Failed to load gRPC binary module because it was not installed
for the current system
Expected directory: electron-v1.8-linux-x64-glibc
Found: [node-v59-linux-x64-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module
I have tried running rebuild but still fails
What elese do i need to do for this to work
I encouter the same issue with
vue-electron 1.0.6
firebase 5.4.2
vuefire 1.4.5
node 6.10.3
The following manipulation has worked for me. I have downgraded :
firebase to 4.6.0
vuefire to 1.4.4
Then ran npm rebuild and yarn and now it works.
I'm not sure all the things I have done are necessary. But for sure it looks like a problem with firebase.

Resources