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.

use of record field "labels" causes unhandled exception TypeError: .google.logging.v2.LogEntry.labels: object expected  #265

@maeldur

Description

@maeldur

Environment details

  • OS: OSX/Linux
  • Node.js version: 8.15
  • npm version: 6.4.1
  • @google-cloud/logging-bunyan version: 0.9.5

Steps to reproduce

  1. Use the field labels within the record object log.info({labels: -1}, 'test')

it will crash with

TypeError: .google.logging.v2.LogEntry.labels: object expected
    at Type.LogEntry$fromObject [as fromObject] (eval at Codegen (/usr/src/app/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:86:9)
    at Type.WriteLogEntriesRequest$fromObject [as fromObject] (eval at Codegen (/usr/src/app/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:30:25)
    at serialize (/usr/src/app/node_modules/grpc/src/protobuf_js_6_common.js:71:23)
    at Object.final_requester.sendMessage (/usr/src/app/node_modules/grpc/src/client_interceptors.js:806:37)
    at InterceptingCall._callNext (/usr/src/app/node_modules/grpc/src/client_interceptors.js:419:43)
    at InterceptingCall.sendMessage (/usr/src/app/node_modules/grpc/src/client_interceptors.js:464:8)
    at InterceptingCall._callNext (/usr/src/app/node_modules/grpc/src/client_interceptors.js:428:12)
    at InterceptingCall.sendMessage (/usr/src/app/node_modules/grpc/src/client_interceptors.js:464:8)
    at ServiceClient.Client.makeUnaryRequest (/usr/src/app/node_modules/grpc/src/client.js:536:21)
    at ServiceClient.method_func (/usr/src/app/node_modules/grpc/src/client.js:950:43)
    at /usr/src/app/node_modules/@google-cloud/logging/build/src/v2/logging_service_v2_client.js:188:39
    at Task.timeoutFunc [as _apiCall] (/usr/src/app/node_modules/google-gax/build/src/api_callable.js:143:16)
    at Task.run (/usr/src/app/node_modules/google-gax/build/src/bundling.js:195:18)
    at BundleExecutor._runNow (/usr/src/app/node_modules/google-gax/build/src/bundling.js:421:14)
    at Timeout._timers.(anonymous function).setTimeout [as _onTimeout] (/usr/src/app/node_modules/google-gax/build/src/bundling.js:367:22)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)

it looks like the protobuf for LogEntry defines the labels field as Object.<string, string>

seems like this is a reserved field so the easiest fix here would probably be to update documentation to avoid using this field (and potentially others?)

Thanks!

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: loggingIssues related to the googleapis/nodejs-logging-bunyan API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions