← All tasks
javascriptgoogleapis/google-cloud-node #4743Not a task: already works

Talent: custom attributes error "Starting an object on a scalar field" when using fallback mode

envgap__googleapis__google-cloud-node-4743

01 / FAILURE SIGNATURE

As reported upstream

Executing it will result in the following error:
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
6e67e5f32f544e545fdbd629981f39f8e9d6d160
Manifest
packages/google-cloud-talent/package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

googleapis/google-cloud-node #4743 · read the original issue
#### Environment details



  - @google-cloud/talent 6.0.1

  - OS: macOS Ventura 13.5.2

  - Node.js version: 18



#### Steps to reproduce



Consider the following snippet:

```js

import { v4 } from '@google-cloud/talent'



const client = new v4.JobServiceClient({ fallback: true })

const [operation] = await client.batchCreateJobs({

  parent: 'your-tenant-path',

  jobs: [

    {

      // <your other job data>

      customAttributes: {

        testAttribute: { longValues: [1], filterable: true },

      },

    },

  ],

})



const [response] = await operation.promise()

```



Executing it will result in the following error:



_Invalid value at 'jobs[0].custom_attributes[0].value.long_values' (long_values), Starting an object on a scalar field

at GoogleError.parseHttpError (/usr/src/app/node_modules/google-gax/build/src/googleError.js:72:37)

   at decodeResponse (/usr/src/app/node_modules/google-gax/build/src/fallbackRest.js:66:49)

   at /usr/src/app/node_modules/google-gax/build/src/fallbackServiceStub.js:104:42

   at process.processTicksAndRejections (node:internal/process/task_queues:95:5)_



This only happens when using fallback mode.



When digging deeper, you will find out that in [fallbackRest.ts (google-gax)](https://github.com/googleapis/gax-nodejs/blob/34a6d6021d2f2f53ceab3b76ef2ceccb5a3f2013/gax/src/fallbackRest.ts#L36), the `fromObject()` method will transform the longValues of a custom attribute into a `Long` object: `longValues: [ Long { low: 1, high: 0, unsigned: false } ]`.

This is most likely wrong, because according to the REST API of Cloud Talent Solutions, the value inside a `longValues` array must be of type number/string (see [here](https://cloud.google.com/talent-solution/job-search/docs/reference/rest/v4/projects.tenants.jobs#CustomAttribute.FIELDS.long_values)).





Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]