@google-cloud/logging-winston (intermediate value).GoogleAuth is not a constructor (vuejs)
I am trying to add @google-cloud/logging-winston to my VueJS project. I followed these https://www.npmjs.com/package/@google-cloud/logging-winston and https://cloud.google.com/logging/docs/samples/logging-winston-quickstart very closely.
I am getting:
TypeError: (intermediate value) (intermediate value) (intermediate value).GoogleAuth is not a constructor
at new Logging(index.js ? 221c: 137: 1)
at new LoggingCommon(common.js ? bc26 : 94: 1)
at new LoggingWinston(index.js ? 1856 : 113: 1)
Here's my code:
const winston = require('winston');
const {LoggingWinston} = require('@google-cloud/logging-winston');
// error here
const gcloudWinston = new LoggingWinston();
I traced the flow of code from new LoggingWinston() --> new LoggingCommon() --> new Logging() and found this line from the @google-cloud/logging library:
this.auth = new (gaxInstance !== null && gaxInstance !== void 0 ? gaxInstance : gax).GoogleAuth(options_);

Question: How do I get new LoggingWinston() to work for my project?
PS: My dependencies are up-to-date:
"dependencies": {
"@google-cloud/logging-winston": "^5.3.0",
"google-gax": "^3.5.8",
"googleapis": "^113.0.0",
"node": "^18.15.0",
"node-polyfill-webpack-plugin": "^2.0.1",
"vue": "^2.7.14",
...
},
Hi @patrickchho, you will need to set up authentications correctly for logging: https://cloud.google.com/docs/authentication/provide-credentials-adc
Could you share more details about the authentication set up in your application?