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

fix(deps): update dependency @google-cloud/secret-manager to v3 #345

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/backends/gcp-secrets-manager-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GCPSecretsManagerBackend extends KVBackend {
* Gets the project id from auth object from the GCP Secret Manager Client
*/
_getProjectId () {
return this._client.auth._cachedProjectId
return this._client.auth.getProjectId()
}

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

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

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

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