You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
Have the following code:
// NOTE - These should be valid credentials, but should miss the `client_email` field:
const credentials = {...}
const transport = new LoggingWinston({
logName: "my-log-name",
projectId: "my-project-id",
credentials,
defaultCallback: (error, apiResponse) => {
if (error) {
logger.error('GCP Transport got error', { error, apiResponse: JSON.stringify(apiResponse) });
}
}
})
const loggerOptions = {
levels: winston.config.syslog.levels,
level: 'debug',
transports: [transport],
exitOnError: false
}
const logger = winston.createLogger(loggerOptions);
// Try to log
logger.info('test')
// Wait 3 seconds
await new Promise(resolve => setTimeout(resolve, 3000));
A clear and concise description of what the bug is, and what you expected to happen.
You get the following crash, as an Unhandled Exception:
Error: The incoming JSON object does not contain a client_email field
at JWT.fromJSON (/Users/arelrabinowitz/Projects/myproject/node_modules/.pnpm/google-auth-library@9.4.1_encoding@0.1.13/node_modules/google-auth-library/build/src/auth/jwtclient.js:203:19)
at GoogleAuth.fromJSON (/Users/arelrabinowitz/Projects/myproject/node_modules/.pnpm/google-auth-library@9.4.1_encoding@0.1.13/node_modules/google-auth-library/build/src/auth/googleauth.js:435:20)
at GoogleAuth._cacheClientFromJSON (/Users/arelrabinowitz/Projects/myproject/node_modules/.pnpm/google-auth-library@9.4.1_encoding@0.1.13/node_modules/google-auth-library/build/src/auth/googleauth.js:447:29)
at GoogleAuth.getClient (/Users/arelrabinowitz/Projects/myproject/node_modules/.pnpm/google-auth-library@9.4.1_encoding@0.1.13/node_modules/google-auth-library/build/src/auth/googleauth.js:665:22)
at GrpcClient._getCredentials (/Users/arelrabinowitz/Projects/myproject/node_modules/.pnpm/google-gax@4.0.5_encoding@0.1.13/node_modules/google-gax/build/src/grpc.js:145:40)
at GrpcClient.createStub (/Users/arelrabinowitz/Projects/myproject/node_modules/.pnpm/google-gax@4.0.5_encoding@0.1.13/node_modules/google-gax/build/src/grpc.js:308:34)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
Adding a try/catch over the logger.info would not help, and the defaultCallback didn't help here either
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
Please make sure you have searched for information in the following guides.
A screenshot that you have tested with "Try this API".
Not a problem with the API, a problem with the library
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
https://gist.github.com/RLRabinowitz/d37492e3627e73c14e1cbe16ba1162a9
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
Have the following code:
A clear and concise description of what the bug is, and what you expected to happen.
You get the following crash, as an Unhandled Exception:
Adding a try/catch over the
logger.infowould not help, and thedefaultCallbackdidn't help here eitherA clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
Logging with winston should not crash