bobHihi
bobHihi

Reputation: 53

NPM build API Vault LIST fail

I am on an NPM application using Svelte and I am looking to develop a server-side API to list the available paths of my Vault HashiCorp instance. By making simple calls with fetch on the Vault REST API, everything works fine. The problem is that a REST API call of type "LIST" works in dev (via "npm run dev") but when I build the application and launch it, this endpoint no longer works. Calls of type "GET" still work after the build. Looking at the Vault logs, the call is passed in type "READ" instead of "LIST". I have tried several things so far:

I still have the same behavior. Here is my implementation of the endpoint :

public async list(path: string): Promise<JSON> {
    const response = await fetch(`${this.endpoint}/${this.apiVersion}/secret/metadata/${path}`, {
        method: 'LIST',
        headers: {
            'X-Vault-Token': this.token,
        },
    });

    const data = await response.json();
    return data;
}

Thank you for help.

Edit : I also try to use axios library for the request.

Upvotes: 0

Views: 17

Answers (0)

Related Questions