Skip to content

Commit

Permalink
fix(samples): correct usage of toString() (#117)
Browse files Browse the repository at this point in the history
* Remove example's unused character encoding

When accessing a secret version, the payload data is of type `string | Uint8Array`, neither of which accepts a character encoding option in their `toString()` function.

Co-authored-by: Stephen <stephenplusplus@users.noreply.github.com>
  • Loading branch information
anchor-crockagile and stephenplusplus authored May 19, 2020
1 parent 790bc8b commit abf66f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion secret-manager/accessSecretVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function main(name = 'projects/my-project/secrets/my-secret/versions/1') {
});

// Extract the payload as a string.
const payload = version.payload.data.toString('utf8');
const payload = version.payload.data.toString();

// WARNING: Do not print the secret in a production environment - this
// snippet is showing how to access the secret material.
Expand Down

0 comments on commit abf66f9

Please sign in to comment.