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

Class extends value undefined is not a constructor or null #1632

Closed
frama21 opened this issue Aug 23, 2023 · 5 comments
Closed

Class extends value undefined is not a constructor or null #1632

frama21 opened this issue Aug 23, 2023 · 5 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@frama21
Copy link

frama21 commented Aug 23, 2023

Environment details

  • OS: Windows 10
  • Node.js version: 16.20.1
  • npm version: 9.8.1
  • google-auth-library version: 9.0.0

Steps to reproduce

  1. I Install the google-auth-library in nuxtjs 3 with vite
  2. then i make the separate helper call spreadsheet.ts for calling the method when i need it
  3. this my inside spreadsheet.ts
    image
  4. then i import spreadsheet.ts in another file to hit the method & i got the error like this
    image

when i comment the const client the error is not showing

@frama21 frama21 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 Aug 23, 2023
@danielbankhead danielbankhead added type: question Request for information or clarification. Not an issue. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 23, 2023
@danielbankhead
Copy link
Contributor

@frama21 this looks more like an issue with the bundler or agent-base rather than this library (looking at the first line of the error).

@danielbankhead
Copy link
Contributor

I cannot seem to reproduce this issue - let me know if there's a specific line or class in the auth library I can assist in debugging.

@danielbankhead danielbankhead closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2023
@phalla-doll
Copy link

I'm having the same error with my Angular 17 project.

Step to reproduce:

  1. Install the Angular 17 version
  2. Install google-auth-library (latest version is 9.6.3)
  3. import {JWT} from "google-auth-library";

const serviceAccountAuth = new JWT({});

@giantpenguin
Copy link

giantpenguin commented Oct 29, 2024

Is it the issue caused by the (google-auth-library) library still uses the require while others (e.g., @googleapis/sheets v4 or a vuejs component) depend on it have been changed to use the import for modules loading?

Uncaught (in promise) TypeError: Class extends value undefined is not a constructor or null
at node_modules/google-auth-library/build/src/auth/authclient.js (authclient.js:31:35)
at __require (chunk-WMTNK64S.js?v=40045171:15:50)
at node_modules/google-auth-library/build/src/auth/oauth2client.js (oauth2client.js:22:22)
at __require (chunk-WMTNK64S.js?v=40045171:15:50)
at node_modules/google-auth-library/build/src/auth/computeclient.js (computeclient.js:19:24)
at __require (chunk-WMTNK64S.js?v=40045171:15:50)
at node_modules/google-auth-library/build/src/auth/googleauth.js (googleauth.js:36:25)
at __require (chunk-WMTNK64S.js?v=40045171:15:50)
at node_modules/google-auth-library/build/src/index.js (index.js:17:22)
at __require (chunk-WMTNK64S.js?v=40045171:15:50)

in this case the events_1 is null due to the events module has not been imported/loaded

const events_1 = require("events");
...
class AuthClient extends events_1.EventEmitter {
constructor(opts = {}) {
...

There is no reference to "events" package in https://github.com/googleapis/google-auth-library-nodejs/blob/main/package.json. Where I can get the "events" module/package @danielbankhead?

@giantpenguin
Copy link

Seeing many warning message in the terminal at building the vue app, many lines from google-auth-library likes

[plugin:vite:resolve] [plugin vite:resolve] Module "fs" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/google-auth-library/build/src/auth/googleauth.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "os" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/google-auth-library/build/src/auth/googleauth.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "path" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/google-auth-library/build/src/auth/googleauth.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "querystring" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/google-auth-library/build/src/auth/refreshclient.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "querystring" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/google-auth-library/build/src/auth/oauth2client.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "fs" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/gtoken/build/src/index.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "path" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/gtoken/build/src/index.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "http2" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/googleapis-common/build/src/http2.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "zlib" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/googleapis-common/build/src/http2.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "url" has been externalized for browser compatibility, imported by "[root_folder]/node_modules/googleapis-common/build/src/http2.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

I realize that it is issue relates to https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants