Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

On API error stream exits and doesn't recover #524

@jmatsumura

Description

@jmatsumura

Environment details

  • OS: Docker container for launcher.gcr.io/google/nodejs (Ubuntu 16)
  • Node.js version: v14.16.0
  • npm version: 6.14.11
  • @google-cloud/logging-bunyan version: 3.0.2
  • bunyan version: 1.8.15

Steps to reproduce

  1. given the following snippet in a file called script.ts:
import { LoggingBunyan } from '@google-cloud/logging-bunyan';
import * as bunyan from 'bunyan';
import * as fs from 'fs';

function getLogger(className: string): bunyan {
  return bunyan.createLogger({
    name: className,
    streams: [
      new LoggingBunyan({
        projectId: 'PROJECT_ID',
        keyFilename: 'PATH_TO_CREDS_JSON',
      }).stream('trace'),
    ],
  });
}

const myLog = getLogger('james-local');

myLog.info({ 'test-1': true });
// myLog.info({ 'test-2': fs.readFileSync('temp_file.json', 'utf8') });
myLog.info({ 'test-3': true });
  1. replace PROJECT_ID and PATH_TO_CREDS_JSON with real values so we can talk to stackdriver locally
  2. run the code without an API error occurring and see no issues logging the myLog.info({ 'test-3': true }); e.g. ts-node script.ts
  3. generate a file slightly larger than the 256K limit to force an API error e.g. mkfile -n 260k temp_file.json
  4. uncomment the line that attempts to log the contents of this file myLog.info({ 'test-2': fs.readFileSync('temp_file.json', 'utf8') });
  5. run the code with an API error occurring and see issues logging, the process exits and never hits the myLog.info({ 'test-3': true }); and results in a stack trace like:
/${PATH_TO_PKG}/node_modules/@grpc/grpc-js/src/call.ts:81
  return Object.assign(new Error(message), status);
                       ^
Error: 3 INVALID_ARGUMENT: Log entry with size 260.3K exceeds maximum size of 256.0K
    at Object.callErrorFromStatus (/${PATH_TO_PKG}/node_modules/@grpc/grpc-js/src/call.ts:81:24)
    at Object.onReceiveStatus (/${PATH_TO_PKG}/node_modules/@grpc/grpc-js/src/client.ts:334:36)
    at Object.onReceiveStatus (/${PATH_TO_PKG}/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
    at Object.onReceiveStatus (/${PATH_TO_PKG}/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
    at /${PATH_TO_PKG}/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

while there are ways to pre-empt this specific API error of exceeding the size limit, would like a way to make sure the stream can resume after this type of event occurs.

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/nodejs-logging-bunyan API.lang: nodejsIssues specific to JavaScript or TypeScript.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions