Environment details
- OS: SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64 GNU/Linux
- Node.js version: v14.17.0
- npm version: 6.14.13
@google-cloud/logging version: 9.2.3
└─┬ @google-cloud/logging-winston@4.0.4
└── @google-cloud/logging@9.2.3
└── winston-transport@4.4.0
└── winston@3.3.3
Steps to reproduce
From sentry:
TypeError Log.truncateEntries(@google-cloud.logging.src:log.ts)
Cannot read property 'forEach' of undefined
/sites/app/node_modules/@google-cloud/logging/src/log.ts in Log.truncateEntries at line 971:20
/sites/app/node_modules/@google-cloud/promisify/build/src/index.js in Log.wrapper at line 106:35
/sites/app/node_modules/@google-cloud/logging/src/log.ts in writeWithResource at line 909:12
/sites/app/node_modules/@google-cloud/logging/src/log.ts in Log.write at line 894:14
/sites/app/node_modules/@google-cloud/promisify/build/src/index.js in Log.wrapper at line 106:35
/sites/app/node_modules/@google-cloud/logging/src/log.ts in Log.error at line 487:17
/sites/app/node_modules/@google-cloud/promisify/build/src/index.js in Log.wrapper at line 109:24
/sites/app/node_modules/@google-cloud/logging-winston/build/src/common.js in LoggingCommon.log at line 164:46
/sites/app/node_modules/@google-cloud/logging-winston/build/src/index.js in LoggingWinston.log at line 119:21
/sites/app/node_modules/winston-transport/index.js in LoggingWinston._write at line 82:19
… /app/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_writable.js in doWrite at line 428:64
… /app/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_writable.js in writeOrBuffer at line 417:5
… /app/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_writable.js in LoggingWinston.Writable.write at line 334:11
/sites/app/node_modules/readable-stream/lib/_stream_readable.js in DerivedLogger.ondata at line 681:20
events.js in DerivedLogger.emit at line 388:22
domain.js in DerivedLogger.emit at line 470:12
Cannot really determine what is causing it, as all I have is this stack trace.
It seems, it's trying to truncate the entries, but there is no entries?
let decoratedEntries: EntryJson[];
try {
decoratedEntries = self.decorateEntries_(arrify(entry) as Entry[]);
} catch (err) {
// Ignore errors (the API will speak up if it has an issue).
}
self.truncateEntries(decoratedEntries!);
Seems to be the clear culprit, is enough to initialise decoratedEntries to be empty array?
Looks like the code in the latest version did not change for that specific logic.
Environment details
@google-cloud/loggingversion: 9.2.3└─┬ @google-cloud/logging-winston@4.0.4
└── @google-cloud/logging@9.2.3
└── winston-transport@4.4.0
└── winston@3.3.3
Steps to reproduce
From sentry:
TypeError Log.truncateEntries(@google-cloud.logging.src:log.ts)Cannot read property 'forEach' of undefinedCannot really determine what is causing it, as all I have is this stack trace.
It seems, it's trying to truncate the entries, but there is no entries?
Seems to be the clear culprit, is enough to initialise decoratedEntries to be empty array?
Looks like the code in the latest version did not change for that specific logic.