nodejs-logging-winston icon indicating copy to clipboard operation
nodejs-logging-winston copied to clipboard

Startup winston logging got error

Open JeffHu88 opened this issue 3 years ago • 0 comments

I try to add google winston with Nestjs project to startup. but got this error:

/Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/call.ts:81 const error = new Error(message); ^ Error: 3 INVALID_ARGUMENT: Timestamp is over a day in the future at Object.callErrorFromStatus (/Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/call.ts:81:17) at Object.onReceiveStatus (/Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/client.ts:352:36) at Object.onReceiveStatus (/Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/client-interceptors.ts:462:34) at Object.onReceiveStatus (/Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/client-interceptors.ts:424:48) at /Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/call-stream.ts:330:24 at processTicksAndRejections (node:internal/process/task_queues:78:11) for call at at ServiceClientImpl.makeUnaryRequest (/Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/client.ts:324:26) at ServiceClientImpl.<anonymous> (/Users/user/Desktop/project/service/node_modules/@grpc/grpc-js/src/make-client.ts:189:15) at /Users/user/Desktop/project/service/node_modules/@google-cloud/logging/src/v2/logging_service_v2_client.ts:384:25 at /Users/user/Desktop/project/service/node_modules/google-gax/src/normalCalls/timeout.ts:54:13 at repeat (/Users/user/Desktop/project/service/node_modules/google-gax/src/normalCalls/retries.ts:104:19) at Task._apiCall (/Users/user/Desktop/project/service/node_modules/google-gax/src/normalCalls/retries.ts:144:7) at Task.run (/Users/user/Desktop/project/service/node_modules/google-gax/src/bundlingCalls/task.ts:177:31) at BundleExecutor._runNow (/Users/user/Desktop/project/service/node_modules/google-gax/src/bundlingCalls/bundleExecutor.ts:282:10) at Timeout._onTimeout (/Users/user/Desktop/project/service/node_modules/google-gax/src/bundlingCalls/bundleExecutor.ts:222:14) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7) this is my setting:

export default () => {
	const loggingWinston = new LoggingWinston({
		projectId: process.env?.GCP_PROJECT_ID,
		serviceContext: {
			service: 'my-service',
			version: 'v1',
		},
	});
	const transports: Transport[] = [
		new winston.transports.Console({
			level: 'debug',
			debugStdout: true,
		}),
		loggingWinston,
	];

return {
		format: winston.format.combine(
			winston.format.splat(),
			winston.format.label(),
			winston.format.timestamp({
				format: 'YYYY-MM-dd HH:mm:ss.SSS',
			}),
			winston.format.align(),
			winston.format.errors({ stack: true }),
			winston.format.printf((option: TransformableInfo) => ...
		),
		transports,
	};

use version: @google-cloud/logging-winston: 5.1.4 winston: 3.8.1

JeffHu88 avatar Sep 02 '22 11:09 JeffHu88