Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NPM ERROR] Interface 'ServiceOptions' incorrectly extends interface #734

Closed
zubairzahoor opened this issue Feb 23, 2022 · 21 comments
Closed
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@zubairzahoor
Copy link

Since today, I am unable to build my project with this error. Nothing changed from our side,

Types of property 'authClient' are incompatible.
11:08:51 Type 'GoogleAuth | undefined' is not assignable to type 'JSONClient | undefined'.
11:08:51 node_modules/@google-cloud/common/build/src/util.d.ts(42,18): error TS2430: Interface 'MakeAuthenticatedRequestFactoryConfig' incorrectly extends interface 'GoogleAuthOptions'.
11:08:51 Types of property 'authClient' are incompatible.
11:08:51 Type 'GoogleAuth | undefined' is not assignable to type 'JSONClient | undefined'.
11:08:51 Type 'GoogleAuth' is not assignable to type 'JSONClient | undefined'.
11:08:51 Type 'GoogleAuth' is missing the following properties from type 'JWT': createScoped, getRequestMetadataAsync, fetchIdToken, hasUserScopes

Environment details

  • OS: CentOS
  • Node.js version: NodeJS_v12.18.2
  • @google-cloud/common version: 3.9.0

Steps to reproduce

A simple npm run build causes this.

@zubairzahoor zubairzahoor added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 23, 2022
@robin-whg
Copy link

Having the same issue with the package in firebase cloud functions.

@zubairzahoor
Copy link
Author

This is most likely an issue with google-auth-library that was updated yesterday.
Issue here: googleapis/google-auth-library-nodejs#1374

@finallyRaunak
Copy link

This is most likely an issue with google-auth-library that was updated yesterday. Issue here: googleapis/google-auth-library-nodejs#1374

Yes, I also think the same, having the same issue with @google-cloud/logging-winston package which uses google-auth-library

@SametSahin10
Copy link

I'm having the same issue.

@bcoe
Copy link
Contributor

bcoe commented Feb 23, 2022

👋 for folks having issues, could you provide the output of npm ls google-auth-library, a new version of the auth library was released yesterday, but the current latest version of the library remained 7.12.0. So, I'm not sure how npm would be pulling in 7.14.0.

@bcoe
Copy link
Contributor

bcoe commented Feb 23, 2022

@SametSahin10 @zubairzahoor follow up question, what @google-cloud library are you using?

@SametSahin10
Copy link

wave for folks having issues, could you provide the output of npm ls google-auth-library, a new version of the auth library was released yesterday, but the current latest version of the library remained 7.12.0. So, I'm not sure how npm would be pulling in 7.14.0.

Output of npm ls google-auth-library:

functions@ /home/sametsahin/work/firebase-projects/flambu/functions
└─┬ firebase-admin@10.0.2
├─┬ @google-cloud/firestore@4.15.1
│ └─┬ google-gax@2.30.0
│ └── google-auth-library@7.14.0 deduped
└─┬ @google-cloud/storage@5.18.2
├─┬ @google-cloud/common@3.9.0
│ └── google-auth-library@7.14.0 deduped
└── google-auth-library@7.14.0

@SametSahin10
Copy link

@SametSahin10 @zubairzahoor follow up question, what @google-cloud library are you using?

Does my last comment answer this as well?

@bcoe
Copy link
Contributor

bcoe commented Feb 23, 2022

@SametSahin10 @zubairzahoor if you remove your package-lock.json and reinstall, you should stop seeing a build error.

I'm keeping this open until the problem is fixed, for now I just rolled back google-gax, which is the dependency forcing 7.14.0 of the auth library.

@danielbankhead
Copy link
Contributor

Hey everyone! Apologies for the broken builds; the type-related issues should now be resolved via (nodejs-common v3.10.0) #733.

@danielbankhead danielbankhead added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Feb 23, 2022
@bcoe
Copy link
Contributor

bcoe commented Feb 23, 2022

@danielbankhead I think because of the collision on the key-name authClient we should call the update to GoogleAuth breaking, or else folks could end up with trees that can't compile.

What do you think?

edit: perhaps as long as all the dependencies are functioning together, we're in okay shape, let's just monitor this closely throughout the day.

@danielbankhead
Copy link
Contributor

[Synced offline, sharing here for visibility]

I think we should be fine, nodejs-common is the only library in googleapis with the name collision (others use the conventional auth param) - and is the only library with issues with the updated auth library.

#733 should resolve this, however I'll keep this open and monitor over the next few days.

@finallyRaunak
Copy link

👋 for folks having issues, could you provide the output of npm ls google-auth-library, a new version of the auth library was released yesterday, but the current latest version of the library remained 7.12.0. So, I'm not sure how npm would be pulling in 7.14.0.

@bcoe : Here is the output

├─┬ @google-cloud/logging-winston@4.1.2
│ └── google-auth-library@7.14.0
├─┬ @google-cloud/logging@9.7.0
│ ├─┬ @google-cloud/common@3.9.0
│ │ └── google-auth-library@7.14.0 deduped
│ ├── google-auth-library@7.14.0 deduped
│ └─┬ google-gax@2.30.0
│ └── google-auth-library@7.14.0 deduped
└─┬ @google-cloud/storage@5.18.2
└── google-auth-library@7.14.0 deduped

@ederius100
Copy link

ederius100 commented Feb 24, 2022 via email

@bcoe
Copy link
Contributor

bcoe commented Feb 24, 2022

@finallyRaunak a clean install (make sure have @google-cloud/common@3.10.0) should address the problem you were seeing.

For anyone else bumping into issues, use npm ls to list deps, and ensure your tree has the latest patch.

@danielbankhead
Copy link
Contributor

Things are looking stable as of @google-cloud/common@3.10.0 - closing. #733.

@appfrilans
Copy link

appfrilans commented Mar 10, 2022

I still have a similar issue.

node_modules/@google-cloud/common/build/src/service.d.ts:29:18 - error TS2430: Interface 'ServiceOptions' incorrectly extends interface 'GoogleAuthOptions<JSONClient>'.
  Types of property 'authClient' are incompatible.
    Type 'GoogleAuth<JSONClient> | undefined' is not assignable to type 'JWT | UserRefreshClient | Impersonated | BaseExternalAccountClient | undefined'.
      Type 'GoogleAuth<JSONClient>' is not assignable to type 'JWT | UserRefreshClient | Impersonated | BaseExternalAccountClient | undefined'.
        Type 'GoogleAuth<JSONClient>' is not assignable to type 'JWT'.

29 export interface ServiceOptions extends GoogleAuthOptions {
                    ~~~~~~~~~~~~~~

node_modules/@google-cloud/common/build/src/util.d.ts:42:18 - error TS2430: Interface 'MakeAuthenticatedRequestFactoryConfig' incorrectly extends interface 'GoogleAuthOptions<JSONClient>'.
  Types of property 'authClient' are incompatible.
    Type 'GoogleAuth<JSONClient> | undefined' is not assignable to type 'JWT | UserRefreshClient | Impersonated | BaseExternalAccountClient | undefined'.
      Type 'GoogleAuth<JSONClient>' is not assignable to type 'JWT | UserRefreshClient | Impersonated | BaseExternalAccountClient | undefined'.
        Type 'GoogleAuth<JSONClient>' is missing the following properties from type 'JWT': createScoped, getRequestMetadataAsync, fetchIdToken, hasUserScopes, and 53 more.

42 export interface MakeAuthenticatedRequestFactoryConfig extends GoogleAuthOptions {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using Firebase Functions with typeScript. Using the following imports:

import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
import * as geofire from "geofire-common";
import * as key from './service-account-key.json';
import { google } from 'googleapis';

Running ´npm ls google-auth-library´ gives me:
└── (empty)

Tried updating all npm's to latest version. My package.json looks like this:

{
  "name": "functions",
  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "build": "tsc",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@google-cloud/logging": "^9.8.0",
    "date-fns": "^2.28.0",
    "dateformat": "^5.0.2",
    "firebase": "^9.6.8",
    "firebase-admin": "^9.8.0",
    "firebase-functions": "^3.18.1",
    "geofire-common": "^5.2.0",
    "googleapis": "^96.0.0",
    "request": "^2.88.2"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^3.9.1",
    "@typescript-eslint/parser": "^3.8.0",
    "eslint": "^7.6.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-promise": "^6.0.0",
    "firebase-functions-test": "^0.2.0",
    "typescript": "^3.8.0"
  },
  "private": true
}

Adding "skipLibCheck": true to my tsconfig.json solves the issue but seems like a workaround.

@bcoe
Copy link
Contributor

bcoe commented Mar 24, 2022

@appfrilans could I bother you to rm package-lock.json, and to reinstall. My guess is you're still on an older version of the auth library.

@appfrilans
Copy link

Solved it by manually installing @google-cloud/common@3.10.0 with npm install --save @google-cloud/logging

@bcoe
Copy link
Contributor

bcoe commented Mar 24, 2022

@appfrilans great, sorry for the slow response I'm glad you're unblocked 👍

@b2m9
Copy link

b2m9 commented Mar 28, 2022

For people who arrive here wondering why they can't deploy new Firebase Cloud Functions anymore:

It seems to me that firebase-admin@10.0.2 requires @google-cloud/storage@5.3.0 which requires @google-cloud/common@3.6.0.

For everyone looking to resolve that without using skipLibCheck:true, run npm install @google-cloud/common@3.10.0 and you should be able to deploy your Cloud Functions again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

9 participants