Aws-sdk UpdateSecret doesn't work to update secrets

0

I have the following code to update a secret in Secrets Manager service. This code is inside a Lambda Function with the following permissions: UpdateSecret, PutSecretValue, UpdateSecretVersionStage and GetSecretValue. When I run the lambda function, I receive no errors, but still my secrets doesn't change. What is the problem? Can I work it around with API request? How?

  const { SecretsManager } = require('aws-sdk');

  // function to update secret
  const secrets = { API_KEY: newValue }
  SecretsClient = new SecretsManager({ region: REGION });
  const allSecrets = await getAllSecrets();
  const updatedSecretsJson = {
    ...allSecrets,
    ...secrets
  };
  const updatedSecrets = JSON.stringify(updatedSecretsJson);
  await SecretsClient.putSecretValue({ SecretId: SECRET_ID, SecretString: updatedSecrets })

Also tried: Also, I've tried giving my lambda function all Secrets Manager permission. The only ways I could update my secrets were by AWS Console and AWS CLI.

Aucune réponse

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions