googleapis / googleapis/google-cloud-node

request body for aiplatformClient.predict(request) is not clearly defined; gRPC error is not clear

Open
#4,309 12 comments 2 reactions 1 assignee Claimed by @dizcology View on GitHub
priority: p3 type: feature request
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

#### Environment details

- which product (packages/*) :
- OS: Mac
- Node.js version: 18.16.0
- npm version: 9.5.1
- google-cloud-node version: ` "@google-cloud/aiplatform": "^2.14.0"`

#### Steps to reproduce

```
// Instantiates a client
const aiplatformClient = new PredictionServiceClient({
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
});

async function callPredict() {
// Construct request
const request = {
endpoint: `projects/${projectId}/locations/us-central1/endpoints/${endpointId}`,
instances: [sampleInstance],
};
// Run request
const response = await aiplatformClient.predict(request);
return response;

}
```

Error from `predict` requesst:

> node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
Error: 3 INVALID_ARGUMENT:
at callErrorFromStatus (/Users/lucksp/dev/myflyid/api/run/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
at Object.onReceiveStatus (/Users/lucksp/dev/myflyid/api/run/node_modules/@grpc/grpc-js/build/src/client.js:192:76)
at Object.onReceiveStatus (/Users/lucksp/dev/myflyid/api/run/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
at Object.onReceiveStatus (/Users/lucksp/dev/myflyid/api/run/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
at /Users/lucksp/dev/myflyid/api/run/node_modules/@grpc/grpc-js/build/src/resolving-call.js:94:78
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
at ServiceClientImpl.makeUnaryRequest (/Users/lucksp/dev/myflyid/api/run/node_modules/@grpc/grpc-js/build/src/client.js:160:34)
at ServiceClientImpl. (/Users/lucksp/dev/myflyid/api/run/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
at /Users/lucksp/dev/myflyid/api/run/node_modules/@google-cloud/aiplatform/build/src/v1/prediction_service_client.js:218:29
at /Users/lucksp/dev/myflyid/api/run/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
at OngoingCallPromise.call (/Users/lucksp/dev/myflyid/api/run/node_modules/google-gax/build/src/call.js:67:27)
at NormalApiCaller.call (/Users/lucksp/dev/myflyid/api/run/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)
at /Users/lucksp/dev/myflyid/api/run/node_modules/google-gax/build/src/createApiCall.js:84:30
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 3,
details: '',
metadata: Metadata {
internalRepr: Map(2) {
'endpoint-load-metrics-bin' => [
Buffer(27) [Uint8Array] [
9, 160, 73, 4, 20, 177, 31, 204,
63, 49, 225, 28, 120, 240, 178, 244,
116, 64, 57, 91, 154, 116, 6, 2,
176, 223, 63
]
],
'grpc-server-stats-bin' => [
Buffer(10) [Uint8Array] [
0, 0, 245, 65, 218,
1, 0, 0, 0, 0
]
]
},
options: {}
}
}

The `predict` method is typed as a `IPredictRequest`:

```
interface IPredictRequest {

/** PredictRequest endpoint */
endpoint?: (string|null);

/** PredictRequest instances */
instances?: (google.protobuf.IValue[]|null);

/** PredictRequest parameters */
parameters?: (google.protobuf.IValue|null);
}
```

based on the error message `3 INVALID_ARGUMENT: ` it seems like one of my arguments is incorrect? But which one? I am guessing the `endpoint` being passed in? But what format should it be? the typing is just `string` with no other details.
This [table of codes](https://grpc.github.io/grpc/core/md_doc_statuscodes.html) doesn't help clarify either

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.