Firebase-functions: Class 'UserRecordMetadata' incorrectly implements interface 'UserMetadata'.

Created on 7 May 2020  路  25Comments  路  Source: firebase/firebase-functions

Related issues

None that I know of.

[REQUIRED] Version info

node:

v14.1.0

firebase-functions:

3.6.1

firebase-tools:

8.2.0

[REQUIRED] Test case

tsc

[REQUIRED] Steps to reproduce

Just compiling my app with latest version.

[REQUIRED] Expected behavior

No error.

[REQUIRED] Actual behavior

node_modules/firebase-functions/lib/providers/auth.d.ts:14:22 - error TS2420: Class 'UserRecordMetadata' incorrectly implements interface 'UserMetadata'.
  Property 'lastRefreshTime' is missing in type 'UserRecordMetadata' but required in type 'UserMetadata'.

14 export declare class UserRecordMetadata implements firebase.auth.UserMetadata {
                        ~~~~~~~~~~~~~~~~~~

  node_modules/firebase-admin/lib/auth.d.ts:28:5
    28     lastRefreshTime: string|null;
           ~~~~~~~~~~~~~~~
    'lastRefreshTime' is declared here.

Were you able to successfully deploy your functions?

tsconfig.json:

"skipLibCheck": true,

needs-triage

Most helpful comment

This is literally been the cause of headache for me for the past day or so.
Everything works with versions:

"firebase-admin": "^8.6.0",
"firebase-functions": "^3.3.0",

but the moment I upgrade to the latest versions:

"firebase-admin": "^8.11.0",
"firebase-functions": "^3.6.1",

errors like these appear:

node_modules/firebase-functions/lib/apps.d.ts:33:21 - error TS7033: Property 'firebaseArgs' implicitly has type 'any', because its get accessor lacks a return type annotation.

33         private get firebaseArgs();
                       ~~~~~~~~~~~~

node_modules/firebase-functions/lib/function-builder.d.ts:64:252 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

64         onCall: (handler: (data: any, context: https.CallableContext) => any) => import("./cloud-functions").TriggerAnnotated & ((req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) & import("./cloud-functions").Runnable<any>;
                                                                                                                                                                                                                                                              ~~~~~                                                                                            

node_modules/firebase-functions/lib/handler-builder.d.ts:21:152 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

21         onRequest: (handler: (req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) => HttpsFunction;
                                                                                                                                                          ~~~~~                                                                           

node_modules/firebase-functions/lib/providers/auth.d.ts:14:22 - error TS2420: Class 'UserRecordMetadata' incorrectly implements interface 'UserMetadata'.
  Property 'lastRefreshTime' is missing in type 'UserRecordMetadata' but required in type 'UserMetadata'.

14 export declare class UserRecordMetadata implements firebase.auth.UserMetadata {
                        ~~~~~~~~~~~~~~~~~~

  node_modules/firebase-admin/lib/auth.d.ts:28:5
    28     lastRefreshTime: string|null;
           ~~~~~~~~~~~~~~~
    'lastRefreshTime' is declared here.

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:98:128 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

98     interface ErrorRequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query>
                                                                                                                                  ~~~~~                                                                                                   

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:99:17 - error TS2707: Generic type 'ErrorRequestHandler' requires between 0 and 1 type arguments.

99         extends core.ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery> { }
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:108:116 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

108     interface Request<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                       ~~~~~                                                                                                              

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:108:131 - error TS2707: Generic type 'Request<P>' requires between 0 and 1 type arguments.

108     interface Request<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                         

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:109:123 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

109     interface RequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                              ~~~~~

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:109:138 - error TS2707: Generic type 'RequestHandler<P>' requires between 0 and 1 type arguments.

109     interface RequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:111:54 - error TS2315: Type 'Response' is not generic.

111     export interface Response<ResBody = any> extends core.Response<ResBody> { }
                                                         ~~~~~~~~~~~~~~~~~~~~~~


Found 11 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the functions@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/raveesh/.npm/_logs/2020-05-07T05_23_43_029Z-debug.log

This is very infuriating :(

All 25 comments

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

trying to install cloud functions from scratch and getting this. Sorry for the rant but 3 hours wasted, cloud function setup couldn't have been more frustrating experience to me.

Adding "skipLibCheck": true to compilorOptions within tsconfig.json did the trick. thanks @lookfirst

is happening for me also, I just did a fresh install and tried to run the code by default in my firebase function and I m getting the same error

found the issue:
"firebase-functions": "3.6.1" requires "firebase-admin": "8.11.0", by default is installing the version '8.12.0'.

This is literally been the cause of headache for me for the past day or so.
Everything works with versions:

"firebase-admin": "^8.6.0",
"firebase-functions": "^3.3.0",

but the moment I upgrade to the latest versions:

"firebase-admin": "^8.11.0",
"firebase-functions": "^3.6.1",

errors like these appear:

node_modules/firebase-functions/lib/apps.d.ts:33:21 - error TS7033: Property 'firebaseArgs' implicitly has type 'any', because its get accessor lacks a return type annotation.

33         private get firebaseArgs();
                       ~~~~~~~~~~~~

node_modules/firebase-functions/lib/function-builder.d.ts:64:252 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

64         onCall: (handler: (data: any, context: https.CallableContext) => any) => import("./cloud-functions").TriggerAnnotated & ((req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) & import("./cloud-functions").Runnable<any>;
                                                                                                                                                                                                                                                              ~~~~~                                                                                            

node_modules/firebase-functions/lib/handler-builder.d.ts:21:152 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

21         onRequest: (handler: (req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) => HttpsFunction;
                                                                                                                                                          ~~~~~                                                                           

node_modules/firebase-functions/lib/providers/auth.d.ts:14:22 - error TS2420: Class 'UserRecordMetadata' incorrectly implements interface 'UserMetadata'.
  Property 'lastRefreshTime' is missing in type 'UserRecordMetadata' but required in type 'UserMetadata'.

14 export declare class UserRecordMetadata implements firebase.auth.UserMetadata {
                        ~~~~~~~~~~~~~~~~~~

  node_modules/firebase-admin/lib/auth.d.ts:28:5
    28     lastRefreshTime: string|null;
           ~~~~~~~~~~~~~~~
    'lastRefreshTime' is declared here.

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:98:128 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

98     interface ErrorRequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query>
                                                                                                                                  ~~~~~                                                                                                   

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:99:17 - error TS2707: Generic type 'ErrorRequestHandler' requires between 0 and 1 type arguments.

99         extends core.ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery> { }
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:108:116 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

108     interface Request<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                       ~~~~~                                                                                                              

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:108:131 - error TS2707: Generic type 'Request<P>' requires between 0 and 1 type arguments.

108     interface Request<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                         

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:109:123 - error TS2694: Namespace '"/home/raveesh/Development/kittygo/chachi-firebase/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.

109     interface RequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                              ~~~~~

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:109:138 - error TS2707: Generic type 'RequestHandler<P>' requires between 0 and 1 type arguments.

109     interface RequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery> { }
                                                                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/firebase-functions/node_modules/@types/express/index.d.ts:111:54 - error TS2315: Type 'Response' is not generic.

111     export interface Response<ResBody = any> extends core.Response<ResBody> { }
                                                         ~~~~~~~~~~~~~~~~~~~~~~


Found 11 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the functions@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/raveesh/.npm/_logs/2020-05-07T05_23_43_029Z-debug.log

This is very infuriating :(

Happened to moi either. While "skipLibCheck: true" does the remedy, waiting for something official from Google to be announced...

I see the same when I updated firebase-admin from ^8.11.0 to ^8.12.0.

"skipLibCheck": true

Add this line to your tsconfig.json does the job.

same thing happened. did the author bother to do type checking before publishing the library?

Property 'lastRefreshTime' is missing in type 'UserRecordMetadata' but required in type 'UserMetadata'.

Force the install of the v8.11.0 and try . It worked for me

I added

export declare class UserRecordMetadata implements firebase.auth.UserMetadata {
    creationTime: string;
    lastSignInTime: string;
    constructor(creationTime: string, lastSignInTime: string);
    lastRefreshTime: string | null;   // added here!
...
}

in the
\node_modules\firebase-functions\lib\providers\auth.d.ts

and it works for me

Do you think modifying the downloaded packages is a good workaround?
Won't it reset the changes if you later update the packages?

Any solution to this, please? I too have the same issue and I am new to Firebase Tools/cloud function as well

Any solution to this, please? I too have the same issue and I am new to Firebase Tools/cloud function as well

just do as @raveesh-me said above, change your versions to make it work

Any solution to this, please? I too have the same issue and I am new to Firebase Tools/cloud function as well

just do as @raveesh-me said above, change your versions to make it work

It is not working for me. When I create a new project using "firebase init", by default it has
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.1"

Even when I run command to uninstall package "uninstall --save [email protected] and [email protected]". (I tried both with and without ^), the packages are not uninstalling.

Even I install the new package versions as "npm install --save firebase-admin@^8.6.0 firebase-functions@^3.3.0" and thought of updating the versions in package.json file, the above command only installs below firebase admin, functions version. Any suggestions?

"firebase-admin": "^8.12.0",
"firebase-functions": "^3.6.1"

Any solution to this, please? I too have the same issue and I am new to Firebase Tools/cloud function as well

just do as @raveesh-me said above, change your versions to make it work

No. As soon as you re-install the dependencies, it will overwrite your changes. You generally shouldn't be hacking on things in the node_modules folder. The correct solution for now is:

tsconfig.json:

"skipLibCheck": true,

Any solution to this, please? I too have the same issue and I am new to Firebase Tools/cloud function as well

just do as @raveesh-me said above, change your versions to make it work

No. As soon as you re-install the dependencies, it will overwrite your changes. You generally shouldn't be hacking on things in the node_modules folder. The correct solution for now is:

tsconfig.json:

"skipLibCheck": true,

Thanks, Bunch!. This worked!

Any solution to this, please? I too have the same issue and I am new to Firebase Tools/cloud function as well

just do as @raveesh-me said above, change your versions to make it work

No. As soon as you re-install the dependencies, it will overwrite your changes. You generally shouldn't be hacking on things in the node_modules folder. The correct solution for now is:

tsconfig.json:

"skipLibCheck": true,

Thank you!

I'm also having this issue and neither upgrading the version, nor adding "skipLibCheck": true to tsconfig.json did it for me

@danipralea That's impossible. skipLibCheck turns off compiling of those files. Something else must be wrong.

"skipLibCheck": true worked for a while but not anymore... Is there any other way I can deploy my functions for now? I hope they're working on a fix

I just tried with latest dependencies (new firebase version) and skipLibCheck works fine.

I just tried with latest dependencies (new firebase version) and skipLibCheck works fine.

Yep this works.

I downgraded fromfirebase-admin: 8.12.0 to firebase-admin: 8.11.0 and it works fine for me without adding the skipLibCheck: true.
Note: I have the latest firebase-functions version (3.6.1)

Thanks to @rwpino for pointing it earlier

It has been fixed in the latest release (8.12.1)

Release Notes

Confirmed.

Was this page helpful?
0 / 5 - 0 ratings