Skip to content

[@google-cloud/compute] BackendServicesClient.list()/get() throws "field balancingMode of type string cannot contain value 0" in 6.14.0 #8971

Description

@polarroyonc

Environment details

  • packages/*: @google-cloud/compute@6.14.0
  • Node.js version: 24.18.0
  • google-gax: 5.0.7 / 5.0.8 (reproduces with both)
  • proto3-json-serializer: 3.0.4

Description

BackendServicesClient.list() and .get() throw a deserialization error on every BackendService that has logConfig set (i.e. virtually all of them), even when the underlying REST API response is completely well-formed (verified independently via a raw authenticated curl against the same compute/v1/.../global/backendServices endpoint — all balancingMode values are proper strings like "UTILIZATION"/"RATE").

This is a regression introduced in 6.14.0. Bisecting confirms:

  • @google-cloud/compute@6.13.0 — succeeds, same live project/data
  • @google-cloud/compute@6.14.0 — fails deterministically, same live project/data

Diffing the two versions' bundled build/protos/protos.json:

  • The Backend and BackendService message schemas are byte-identical between 6.13.0 and 6.14.0.
  • BackendServiceLogConfig gained two new fields in 6.14.0 — loggingHttpRequestHeaders and loggingHttpResponseHeaders — inserted before the existing optionalFields/optionalMode/sampleRate fields in declaration order.

That insertion appears to desync proto3-json-serializer@3.0.4's field decode when walking the response, causing it to misattribute some other field's value (most likely logConfig.sampleRate, an int every backend service here has set) onto Backend.balancingMode, which is declared as a string — hence the type-mismatch throw.

Steps to reproduce

import { BackendServicesClient } from '@google-cloud/compute'

const client = new BackendServicesClient()
await client.list({ project: '<any project with backend services that have logConfig set>', maxResults: 500 })

With @google-cloud/compute@6.13.0 this succeeds. With 6.14.0 it throws:

Error: fromProto3JSONToInternalRepresentation: field balancingMode of type string cannot contain value 0
    at fromProto3JSONToInternalRepresentation (proto3-json-serializer/build/src/fromproto3json.js:128:23)
    at proto3-json-serializer/build/src/fromproto3json.js:110:52
    at Array.map (<anonymous>)
    at fromProto3JSONToInternalRepresentation (proto3-json-serializer/build/src/fromproto3json.js:110:37)
    at proto3-json-serializer/build/src/fromproto3json.js:110:52
    at Array.map (<anonymous>)
    at fromProto3JSONToInternalRepresentation (proto3-json-serializer/build/src/fromproto3json.js:110:37)
    at Object.fromProto3JSON (proto3-json-serializer/build/src/fromproto3json.js:154:26)
    at decodeResponse (google-gax/build/src/fallbackRest.js:111:32)
    at google-gax/build/src/fallbackServiceStub.js:166:42 {
  note: 'Exception occurred in retry method that was not classified as transient'
}

Same result via .get({ project, backendService }) on individual backend services — reproduces on every single one that has logConfig set, regardless of its actual balancingMode/data content.

Expected behavior

list()/get() should succeed and correctly decode balancingMode as before, regardless of whether logConfig.loggingHttpRequestHeaders/loggingHttpResponseHeaders are populated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions