google-cloud-node icon indicating copy to clipboard operation
google-cloud-node copied to clipboard

[securitycenter] v2 client's `apiEndpoint` property is wrong when a regional endpoint is specified

Open hegemonic opened this issue 1 year ago • 2 comments

Please make sure you have searched for information in the following guides.

  • [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
  • [X] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
  • [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
  • [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq
  • [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
  • [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
  • [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples

A screenshot that you have tested with "Try this API".

n/a

Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.

https://gist.github.com/hegemonic/cf807026d8b83c14aa0b225b16967599

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

Run the code. It creates a v2 SecurityCenterClient; sets the apiEndpoint to securitycenter.me-central2.rep.googleapis.com; and prints the expected and actual apiEndpoint for the client.

A clear and concise description of what the bug is, and what you expected to happen.

The code prints the following:

expected apiEndpoint: securitycenter.me-central2.rep.googleapis.com
actual apiEndpoint: securitycenter.googleapis.com
client._opts.apiEndpoint: securitycenter.me-central2.rep.googleapis.com

I expected it to print the following:

expected apiEndpoint: securitycenter.me-central2.rep.googleapis.com
actual apiEndpoint: securitycenter.me-central2.rep.googleapis.com
client._opts.apiEndpoint: securitycenter.me-central2.rep.googleapis.com

A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

  • If I specify an API endpoint, the client object shouldn't say that it's using the default endpoint.
  • You shouldn't need to look at private properties to figure out which endpoint the client is using.

hegemonic avatar Sep 27 '24 20:09 hegemonic