Reputation: 203
I'm trying to access secrets stored in GCP secret manager. using following sample code and before deploy its transpiled using babel.
const { SecretManagerServiceClient } = require("@google-cloud/secret-manager");
const client = new SecretManagerServiceClient();
exports.hello = () => {
//do something with client
};
transpiled version of the same
"use strict";
var _require = require("@google-cloud/secret-manager"),
SecretManagerServiceClient = _require.SecretManagerServiceClient;
var client = new SecretManagerServiceClient();
exports.hello = function () {//do something with client
};
however I'm getting following error at secret manager instantiation(const client = new SecretManagerServiceClient();
)
Detailed stack trace: Error: Node.js v10.0.0 is a minimum requirement. To learn about legacy version support visit: https://github.com/googleapis/google-cloud-node#supported-nodejs-versions
at new GrpcClient (/srv/node_modules/@google-cloud/secret-manager/node_modules/google-gax/build/src/grpc.js:63:19)
at new SecretManagerServiceClient (/srv/node_modules/@google-cloud/secret-manager/build/src/v1/secret_manager_service_client.js:99:25)
at Object.<anonymous> (/srv/index.js:6:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
I'm able to access/modify secret using the same library when I try in my local machine. however it doesn't seem to work with CFs.
CF service account has access to secret-manager.
any help would be appreciated. thanks in advance.
Upvotes: 0
Views: 975
Reputation: 203
As pointed out by @sethvargo, specifying runtime during deployment solved the issue.
Upvotes: 0