Home > Mobile >  While testing for Rotating secret through lambda function
While testing for Rotating secret through lambda function

Time:11-14

this is my lambda function (https://github.com/aws-samples/aws-secrets-manager-rotation-lambdas/blob/master/SecretsManagerRotationTemplate/lambda_function.py) when i am testing

{"arn":"writing arn from secret",
"token":"any random 32 digit number",
"step":"testsecret"}

giving error

  "errorMessage": "'SecretId'",
  "errorType": "KeyError",
  "requestId": "########",
  "stackTrace": [
    "  File \"/var/task/lambda_function.py\", line 24, in lambda_handler\n    arn = event['SecretId']\n"
  ]
}

CodePudding user response:

The function expects 'SecretId' in the event, but your current event does not have it:

{"arn":"writing arn from secret",
"token":"any random 32 digit number",
"step":"testsecret"}

Guess that arn should be SecretId:

{"SecretId":"writing arn from secret",
"token":"any random 32 digit number",
"step":"testsecret"}

You will probably have other similar errors which you have to fix in the same way.

  • Related