Skip to content
This repository was archived by the owner on Jul 26, 2022. It is now read-only.

Commit 2bf42db

Browse files
renovate[bot]renovate-botFlydiverny
authored
fix(deps): update dependency @google-cloud/secret-manager to v3 (#345)
* fix(deps): update dependency @google-cloud/secret-manager to v3 * fix: use public api of secret-manager dependency Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Markus Maga <[email protected]>
1 parent 4c2ae7b commit 2bf42db

File tree

3 files changed

+276
-158
lines changed

3 files changed

+276
-158
lines changed

lib/backends/gcp-secrets-manager-backend.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GCPSecretsManagerBackend extends KVBackend {
1818
* Gets the project id from auth object from the GCP Secret Manager Client
1919
*/
2020
_getProjectId () {
21-
return this._client.auth._cachedProjectId
21+
return this._client.auth.getProjectId()
2222
}
2323

2424
/**
@@ -31,7 +31,7 @@ class GCPSecretsManagerBackend extends KVBackend {
3131
async _get ({ key, keyOptions, specOptions: { projectId } }) {
3232
if (!projectId) {
3333
// get the project id from client
34-
projectId = this._getProjectId()
34+
projectId = await this._getProjectId()
3535
}
3636

3737
let secretVersion = 'latest'
@@ -41,10 +41,10 @@ class GCPSecretsManagerBackend extends KVBackend {
4141

4242
this._logger.info(`fetching secret ${key} from GCP Secret for project ${projectId} with version ${secretVersion}`)
4343

44-
const version = await this._client.accessSecretVersion({
44+
const [version] = await this._client.accessSecretVersion({
4545
name: 'projects/' + projectId + '/secrets/' + key + '/versions/' + secretVersion
4646
})
47-
const secret = version[0].payload.data.toString('utf8')
47+
const secret = version.payload.data.toString('utf8')
4848
// Handle binary files - this is useful when you've stored a base64 encoded string
4949
if (keyOptions && keyOptions.isBinary) {
5050
return Buffer.from(secret, 'base64')

0 commit comments

Comments
 (0)