Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception when we have missing request params when calling instancesGroupsClient.list #1203

Open
benbaler opened this issue Mar 15, 2022 · 2 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@benbaler
Copy link

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.<computed> [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.<anonymous> (/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!
}

@benbaler benbaler added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 15, 2022
@eduardk-noname
Copy link

+1

@sofisl
Copy link
Contributor

sofisl commented Jul 12, 2022

Opened #1291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants