Nerdstorage vault error

Hi everyone i try implement nerdstorage vault of the next form:
image
now coming the rare when is correct the api returns error but even so save key, this error look so:


sincery i am not understand for what save keys but return error, additional i am search error in the net but not find solution.
thanks for you answers

@jgaona Looks like you’re still waiting one some answers to your problem. I’m going to reach out to @mfrederick to see if they may be able to help :slight_smile:

1 Like

Hi @jgaona :wave:!

Our SDK offers two different components corresponding with GraphQL’s two main types Query and Mutation.

The error you’re seeing is because you are using NerdGraphQuery.query with a mutation instead of using NerdGraphMutation.mutate.

Updating to something like this should help:

import { NerdGraphMutation } from 'nr1';

async function writeSecret(key,value) {
  const gql = `
    mutation writeSecret($key: String!, $value: SecureValue!) {
      nerdStorageVaultWriteSecret(
        scope: { actor: CURRENT_USER }
        secret: { key: $key, value: $value }
      ) {
        status
        errors {
          message
          type
        }
      }
    }
  `;

  return NerdGraphMutation.mutate({
    mutation: gql,
    variables: {
      key,
      value
    }
  }).then((response) => {
    return response;
  }).catch(err => {
    return err.message;
  });
}

Hope this helps!

3 Likes

Thanks for you answer @mfrederick it worked for me , additional my structure defined in my question It would help me to consult the stored keys? :thinking:

1 Like

Is there a way to writte multiple secrets in a single mutation? using variables

By the way, I am getting this error when I try to writte or fetch a secret:
Resolution of this value experienced a timeout.

errors: [{extensions: {errorClass: "TIMEOUT"}, locations: [{column: 25, line: 1}],…}]
0: {extensions: {errorClass: "TIMEOUT"}, locations: [{column: 25, line: 1}],…}
extensions: {errorClass: "TIMEOUT"}
locations: [{column: 25, line: 1}]
message: "Resolution of this value experienced a timeout."
path: ["actor", "nerdStorageVault", "secrets"]