nodejs-datastore icon indicating copy to clipboard operation
nodejs-datastore copied to clipboard

Unable to exclude large indexes

Open dogmatic69 opened this issue 3 months ago • 0 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

  1. Is this a client library issue or a product issue? client lib

  2. Did someone already solve this? existing feature that is broken

  3. Do you have a support contract? no

Environment details

  • OS: Alpine
  • Node.js version: 21.7.1
  • yarn: 1.22.19
  • @google-cloud/datastore version: 8.5.0

Steps to reproduce

in the code, when passing data with the name/value format rather than a normal object, this functionality seems to be completely skipped.

Simple save function with the excludeLargeProperties prop hard coded to true results in error that a field is too large. Given the prop is true, I'd expect it to ignore any large fields.

Feasible to include this functionality or do I avoid using the verbose data structure when saving?

await instance.save({
  key,
  data: [
    {
      name: 'field_a',
      value: 'value_a',
    },
    {
      name: 'field_b',
      value: {
        nested_field: 'nested_value', // completely ignored
      },
    }
  ],
  excludeLargeProperties: true,
})

The above code with a suitably large field results in errors like this

Error saving data: 3 INVALID_ARGUMENT: The value of property "content" is longer than 1500 bytes. Error: 3 INVALID_ARGUMENT: The value of property "content" is longer than 1500 bytes.
    at callErrorFromStatus (/app/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
    at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client.js:192:76)
    at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
    at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
    at /app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:99:78
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at ServiceClientImpl.makeUnaryRequest (/app/node_modules/@grpc/grpc-js/build/src/client.js:160:32)
    at ServiceClientImpl.<anonymous> (/app/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
    at /app/node_modules/@google-cloud/datastore/build/src/v1/datastore_client.js:232:29
    at /app/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
    at OngoingCall.call (/app/node_modules/google-gax/build/src/call.js:67:27)
    at NormalApiCaller.call (/app/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)
    at /app/node_modules/google-gax/build/src/createApiCall.js:108:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

dogmatic69 avatar Mar 21 '24 08:03 dogmatic69