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

Startup winston logging got error #736

Closed
JeffHu88 opened this issue Sep 2, 2022 · 7 comments
Closed

Startup winston logging got error #736

JeffHu88 opened this issue Sep 2, 2022 · 7 comments
Assignees
Labels
api: logging Issues related to the googleapis/nodejs-logging-winston API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@JeffHu88
Copy link

JeffHu88 commented Sep 2, 2022

use version:

  • @google-cloud/logging-winston: 5.1.4
  • winston: 3.8.1

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

  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,
	};
@JeffHu88 JeffHu88 added priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue. labels Sep 2, 2022
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/nodejs-logging-winston API. label Sep 2, 2022
@losalex losalex assigned losalex and unassigned daniel-sanche Sep 2, 2022
@JeffHu88
Copy link
Author

JeffHu88 commented Sep 8, 2022

Hi team, am I setting it wrong?

@losalex
Copy link
Contributor

losalex commented Sep 8, 2022

@JeffHu88 , thanks for reaching out! I wonder what happens if you omit the timestamp formatting - does all works for you?

@JeffHu88
Copy link
Author

I try to omit the timestamp formatting and rebuild it work by remove node module. but I don't know why?

@losalex
Copy link
Contributor

losalex commented Sep 23, 2022

@JeffHu88 , I am sorry but I must admit I did not understood your comment - correct me if I wrong but omitting a timestamp formatting works for you, right?

@JeffHu88
Copy link
Author

yes, and I add timestamp back, it can work now.

@losalex
Copy link
Contributor

losalex commented Sep 23, 2022

Oh, I see - thanks for update!
If everything works now, I am not sure what happened and tend to believe it might be related to your environment - perhaps there were issues with clock which was misconfigured?
Also, please let me know how else I can assist here - if there is no more questions, I will be closing this issue.
Thanks!

@JeffHu88
Copy link
Author

Ok, I don't have questions. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/nodejs-logging-winston API. priority: p3 Desirable enhancement or 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

3 participants