nodejs-logging: Regular error showing Total timeout of API google.logging.v2.LoggingServiceV2 exceeded 600000 milliseconds
Hi, Im getting a similar error:
C:\Users\Lenovo\myproject\node_modules\google-gax\build\src\normalCalls\retries.js:66
const error = new googleError_1.GoogleError(`Total timeout of API ${apiName} exceeded ${retry.backoffSettings.totalTimeoutMillis} milliseconds before any response was received.`);
^
GoogleError: Total timeout of API google.logging.v2.LoggingServiceV2 exceeded 60000 milliseconds before any response was received.
at repeat (C:\Users\Lenovo\myproject\node_modules\google-gax\build\src\normalCalls\retries.js:66:31)
at Timeout._onTimeout (C:\Users\Lenovo\myproject\node_modules\google-gax\build\src\normalCalls\retries.js:101:25)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
code: 4
}
Im using: “@google-cloud/language”: “^4.2.8”, “@google-cloud/logging”: “^9.6.2”, “@google-cloud/storage”: “^5.15.0”,
with: “google-gax”: “^2.28.1”.
I’m running a nestjs app and using Google Logging for NodeJS
Thanks a lot in advance for your help!
_Originally posted by @yhernesto in https://github.com/googleapis/nodejs-logging/issues/972#issuecomment-968173656_
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 15 (4 by maintainers)
Hi, I’m also getting this error in google cloud function.
node v12, “@google-cloud/logging”: “^9.2.2”, “@google-cloud/logging-winston”: “^4.0.4”, pub/sub cloud function
The cloud function finished with status ‘ok’ at 18:40:27, and then it arises an
Unhandled rejection
and timeout error at 18:41:45Seeing the same issue on multiple Cloud Run instances.
Using:
If you’re seeing this issue often and you’re in a serverless environment like Cloud Run you should enable writing to stdout so that log writes aren’t async. This is documented here
One more thing to mention - if your code is running in serverless environment (e.g. Cloud Functions or Cloud Run), it is important to remember that serverless environment have only compute/memory resources for the duration of the request, so if you do something like:
logger.log('foo');
rather than:await logger.log('foo');
you might get timeouts.There are some alternatives which can be used:
JSON.stringify
as described here.There is a good blog post which provides tips for running Node.js in Cloud Funcrions/Cloud Run here.
Also seeing this error, using
"@google-cloud/logging-winston": "^4.1.1"
. The app has internet connectivity at all times but still the error happenshaving the same issue in my cloud function
My code uses a winston logger with LoggingWinston transport from “@google-cloud/logging-winston”:
then I log using winston’s methods like logger.info, logger.verbose. The methods are sync, so there’s no await.
I get this error too if a request came to my app (in local development) when the internet was disconnected. This is obviously not likely to occur in production, but it is possibly unexpected behaviour for the app to crash whenever the logging library is unable to reach the GCP endpoint? (Especially given the ‘fire and forget’ approach recommended in the docs.)
This may be correct behaviour, but I assume a lot of users will want to set up some sort of global error catching for this particular error.