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

The `fromStream` method is deprecated. Please use the `JWT` constructor with a parsed stream instead.

Open leon opened this issue 3 months ago • 0 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://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
  • [x] Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
  • [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
  • [x] Check the API's issue tracker: https://cloud.google.com/support/docs/issue-trackers

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

This commit in google-auth-library is causing SecretManagerServiceClient to spit out console errors

https://github.com/googleapis/google-auth-library-nodejs/pull/2143/files

Solution

migrate away from fromStream and fromJSON to the newer implementations which also validates the input.

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/leon/1ffa1b5ce77fad53ccdec8540cf77841

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

Minimal reproduction

import { SecretManagerServiceClient } from '@google-cloud/secret-manager'

const secretClient = new SecretManagerServiceClient()
const secretResponse = await secretClient.accessSecretVersion({ name: 'projects/123123123123/secrets/my-secret/versions/latest' })

Will output

The `fromStream` method is deprecated. Please use the `JWT` constructor with a parsed stream instead. For more details, see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials.

The `fromJSON` method is deprecated. Please use the `JWT` constructor instead. For more details, see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials.

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

when calling the secrets apis we should not get console.warn messages

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. **

The recent changes to the security holes in fromJSON, fromStream.

https://github.com/googleapis/google-auth-library-nodejs/pull/2143/files

leon avatar Oct 07 '25 11:10 leon