Closed frama21 closed 1 year ago
@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).
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.
I'm having the same error with my Angular 17 project.
Step to reproduce:
const serviceAccountAuth = new JWT({});
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?
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
Environment details
google-auth-library
version: 9.0.0Steps to reproduce
when i comment the const client the error is not showing