Getting error while accessing the VAULT

Hi Team,

On APIGEE cloud, I have created a Vault. Now, I am trying to access the secret using NODE.js

I have gone through the link

https://github.com/apigee/apigee-access

http://docs.apigee.com/api-services/content/using-secure-store

I have written below code :-

var apigee = require('apigee-access'); var token = "";

if (apigee.getMode() === 'apigee') { // test to see if running on Edge var orgVault = apigee.getVault('gv', 'organization'); orgVault.get('gVEntry', function(err, secretValue) { if (err) { console.log(err); next(err); } else { token = secretValue; console.log("Token:"); } }); } else { if (process.argv[2]) { // if local, grab from token command line arguments token = process.argv[2]; console.log("Token no:2" + token); } console.log("Token no:1" + token); }

But I get below Error while calling the api proxy.

Script node executed prematurely: Script hello-world.js exited with status code 0

Can you please let me know if I am missing something?

Thanks and Regards,

Gaurav Bhandari

1 2 182
2 REPLIES 2

Dear @gbhandari,

You will need to create a http server inside which you can read the data from vault in your hello-world.js. You can refer here for more details.

I have also attached a sample API bundle that demonstrates how to read the values from vault and then use it in other policies for your reference.

Regards,

Amar

samplevaultapi.zip

akoo
Participant V

Hello all, I wanted to add an important note: encrypted KVMs are here. Details are in our documentation: http://docs.apigee.com/api-services/reference/key-value-map-operations-policy . You now have an option for encrypted data without having to use Node.js.