Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloud Function Deployment - TypeError: instance.INTERNAL.registerComponent is not a function

I'm getting this error when I try to deploy Cloud Functions. Have tried with firebase-admin 8.8.0, 8.7.0, and 8.6.1 (the last 3 versions)

Running firebase-functions 3.3.0

Any idea what the problem is? Anyone else have this issue?

Error: Error occurred while parsing your function triggers.

TypeError: instance.INTERNAL.registerComponent is not a function
    at registerDatabase (/PATH/cloud-functions/functions/node_modules/firebase-admin/node_modules/@firebase/database/dist/index.node.cjs.js:15165:39)
    at Object.<anonymous> (/PATH/cloud-functions/functions/node_modules/firebase-admin/node_modules/@firebase/database/dist/index.node.cjs.js:15196:5)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at FirebaseNamespace.get [as database] (/PATH/cloud-functions/functions/node_modules/firebase-admin/lib/firebase-namespace.js:282:38)
like image 764
siefix Avatar asked Dec 10 '19 21:12

siefix


2 Answers

instance.INTERNAL.registerComponent

resides inside firebase/app library

So running npm install @firebase/app --save fixes the issue

like image 150
Sandeep Rana Avatar answered Jan 02 '23 19:01

Sandeep Rana


In my case, I already had @firebase/app as part of firebase. I also have node 12 installed with Win 10

npm ls @firebase/app
functions@ C:\Users\me\source\repos\admin\functions
`-- [email protected]
  `-- @firebase/[email protected]

I fixed the issue by updating the firebase dependencies to the latest.

npm i --save firebase@latest firebase-admin@latest firebase-functions@latest

From my package.json:

    "firebase": "^8.2.4",
    "firebase-admin": "^9.4.2",
    "firebase-functions": "^3.13.1",

Note: Always update firebase-tool to the latest:

   npm i -g firebase-tools@lates
like image 34
JoMendez Avatar answered Jan 02 '23 21:01

JoMendez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!