firebase --version is 7.13.1node --version is v12.15.0npm --version is 6.13.7Here is the package.json in the functions folder:
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"main": "lib/index.js",
"dependencies": {
"@firebase/app": "^0.4.26",
"@types/cors": "^2.8.6",
"@types/node": "^12.12.17",
"@types/stripe": "^7.13.16",
"cors": "^2.8.5",
"firebase": "^7.8.2",
"firebase-admin": "^8.8.0",
"firebase-functions": "^3.3.0",
"stripe": "^7.14.0"
},
"devDependencies": {
"tslint": "^5.12.0",
"typescript": "^3.2.2",
"firebase-functions-test": "^0.1.6"
},
"private": true
}
Platform:
Win 10 and MacOS Catalina V 10.15.3
Everything worked fine until this morning at 9:00AM. We did a recent deployment of our functions yesterday evening and came in today and noticed this error in the logs. Nothing we did yesterday would throw this kind of error.
My scenario: This error gets thrown when stripe sends a web hook. When I test the function locally through an http request it works fine.
This started happening completely randomly. We made no changes to configuration so I am not sure what is even producing this behavior.
To not throw the error and the function to work fine.
TypeError: instance.registerVersion is not a function
at registerDatabase (/srv/node_modules/@firebase/database/dist/index.node.cjs.js:15340:14)
at Object.<anonymous> (/srv/node_modules/@firebase/database/dist/index.node.cjs.js:15353:5)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at FirebaseNamespace.get [as database] (/srv/node_modules/firebase-admin/lib/firebase-namespace.js:282:38)
@Cantum2 can you try updating this dependency:
"@firebase/app": "^0.4.26",
You should be safe to just do this:
npm install --save @firebase/app@latest
That solved my issue! Thank you so much! Is there any explanation of why this occurred out of no where?
@Cantum2 hard to guess exactly but probably because you have a package-lock.json in one location that's different from the other location. So npm install could have different results since "^0.4.26" is not a pinned version.
I would also recommend seeing how it works without the @firebase/app dependency at all, that will be better long-term.
Awesome thank you for getting back to me and thank you even more for helping me solve this!
I had the same problem, and installing @firebase/app@latest (0.5.5) worked for me too -- thanks!
@samtstern Hey Sam - I'm getting the same error here, even after installing 0.4.26. The error goes away when I upgrade to the latest, but that breaks another critical library I'm using (https://github.com/tylermcginnis/re-base/) and would prefer not to try and debug that one.
Any other suggestions on how to get rid of this error so I can firebase deploy?
@taykcrane yeah unfortunately that's a tough situation ... re-base looks like it hasn't been updated in a few years so I'm not surprised that it breaks with the latest SDK.
I don't think there's anything we can do about that here though, you'll need to raise an issue on that library and see if they can update their dependencies.
Most helpful comment
@Cantum2 can you try updating this dependency:
You should be safe to just do this: