0

Request to hashicorp vault works through cURL but not through a Node JS program.

cURL request:

curl --header "X-Vault-Namespace:infrastructure/abc/def" --header "X-Vault-Token:hvs.xyzabcdef" --request GET "https://hcvault-nonprod.com/v1/kvtest/data/abc"

Node JS program:


const vault = require("node-vault")({
    apiVersion: "v1",
    endpoint: "\"https://hcvault-nonprod.com",
    requestOptions: {
        strictSSL: false
    },
    namespace: "infrastructure/abc/def",
    token: "hvs.xyzabcdef"
});

const { data } = await vault.read("kvtest/data/abc");

const testVal = data.data.testkey;

    console.log({
        testVal
    });

run();


Issue: The cURL command retrieves the secret as expected but the node js program returns a bunch of unexpected html output.

Ananya S
  • 1
  • 1

0 Answers0