After updating to the newest firebase SDK and tools
npm install firebase-functions@latest firebase-admin@latest --save
npm install -g firebase-tools
I started getting the following error when trying to deploy my firebase functions:
TypeError: instance.INTERNAL.registerComponent is not a function
at registerDatabase (/Users/jr/projects/docavea/functions/node_modules/@firebase/database/dist/index.node.cjs.js:15168:39)
at Object.<anonymous> (/Users/jr/projects/docavea/functions/node_modules/@firebase/database/dist/index.node.cjs.js:15200:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at FirebaseNamespace.get [as database] (/Users/jr/projects/docavea/functions/node_modules/firebase-admin/lib/firebase-namespace.js:282:38)
I have found posts on https://github.com/firebase/firebase-admin-node/issues/714 and
https://github.com/firebase/firebase-admin-node/issues/717 and https://twitter.com/plane1113/status/1203009025232654336 that suggests various solutions for this problem, but none of them worked for me, except to include @firebase/app. Some suggested that this was cause by having @firebase/app somewhere in my project but when I ran
npm ls @firebase/app
I got
functions@ /Users/jr/projects/docavea/functions
└── (empty)
So my question is: What is @firebase/app and is it a problem to include it in my firebase functions package.json
{
"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"
},
"main": "lib/src/index.js",
"dependencies": {
"@firebase/app": "^0.5.0",
"@sendgrid/mail": "^6.4.0",
"cors": "^2.8.5",
"firebase-admin": "^8.9.0",
"firebase-functions": "^3.3.0",
"lodash": "^4.17.15",
"mailchimp-api-v3": "^1.13.1"
},
"peerDependencies": {
"@google-cloud/firestore": "^3.3.2"
},
"engines": {
"node": "8"
},
"devDependencies": {
"tslint": "^5.20.1",
"typescript": "^3.7.4"
},
"private": true
}