googleapis / googleapis/google-cloud-node
Uncaught exception when we have missing request params when calling instancesGroupsClient.list
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
we got this error when using @google-cloud/compute and we unable to catch this error with try/catch (we only able to catch it using process.on('uncaughtException', ...) but its not what we looking for:
```
/backend/node_modules/google-gax/build/src/transcoding.js:225
throw new Error(`Required field ${requiredField} is not present in the request.`);
^
Error: Required field zone is not present in the request.
at Object.transcode (/backend/node_modules/google-gax/build/src/transcoding.js:225:19)
at encodeRequest (/backend/node_modules/google-gax/build/src/fallbackRest.js:52:38)
at Object.serviceStub. [as list] (/backend/node_modules/google-gax/build/src/fallbackServiceStub.js:40:37)
at /backend/node_modules/@google-cloud/compute/build/src/v1/instance_groups_client.js:190:29
at wrappedCall (/backend/node_modules/google-gax/build/src/paginationCalls/pagedApiCaller.js:86:20)
at Immediate. (/backend/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16)
at processImmediate (node:internal/timers:468:21)
[nodemon] app crashed - waiting for file changes before starting...
```
- OS:
- Node.js version: 16.14.0
- npm version: 8.31
- `google-gax` version: 2.29.5
#### Steps to reproduce
```
try {
const credentials = {email: 'blah', key: 'blah'}
const instancesGroupsClient = new Compute.InstanceGroupsClient(credentials)
const [instanceGroupList] = await instancesGroupsClient.list(
{
project: projectId,
zone: null // Intentionally triggers an error!
}
)
return instanceGroupList
} catch(e) => {
console.error("Error - ", e) // will never get here on exception from instancesGroupsClient.list!
}
```
Contributor guide
Assessment
This issue has not been assessed yet.