Получение ошибки при запросе aurora serverless db из lamda с использованием node.js - MissingRequiredParameter: отсутствует требуемый ключ secretArn в параметрах
Я использую приведенный ниже код для запроса таблиц в aurora serverless db через лямбда-функцию, записанную в node.js. Я правильно упаковал свой код со структурой lambda_layer и загрузил zip в aws lambda и применил все необходимые политики, а также все еще получаю ошибки:
const AWS = require('aws-sdk')
const RDS = new AWS.RDSDataService()
exports.handler = async (event, context, callback) => {
try {
const params = {
awsSecretStoreArn: 'xxxxxx',
dbClusterOrInstanceArn: 'xxxxx',
sql: `SELECT * FROM employee WHERE id = :id`,
parameters: [
{
name: 'id',
value: {
"longValue": 1
}
}
],
database: 'test_data_api'
}
let data = await RDS.executeStatement(params).promise()
console.log(JSON.stringify(data, null, 2))
return 'done'
} catch(e) {
console.log(e)
}
}
Но, к сожалению, ошибка ниже:
missingRequiredParameter',
time: 2020-09-03T16:06:47.127Z
},
MissingRequiredParameter: Missing required key 'secretArn' in params
at ParamValidator.fail (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:50:37)
at ParamValidator.validateStructure (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:61:14)
at ParamValidator.validateMember (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:88:21)
at ParamValidator.validate (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:34:10)
at Request.VALIDATE_PARAMETERS (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/event_listeners.js:132:42)
at Request.callListeners (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at callNextListener (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at /var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/event_listeners.js:86:9
at finish (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/config.js:386:7)
at /var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/config.js:404:9 {
code: 'MissingRequiredParameter',
time: 2020-09-03T16:06:47.127Z
},
UnexpectedParameter: Unexpected key 'awsSecretStoreArn' found in params
at ParamValidator.fail (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:50:37)
at ParamValidator.validateStructure (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:77:14)
at ParamValidator.validateMember (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:88:21)
at ParamValidator.validate (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:34:10)
at Request.VALIDATE_PARAMETERS (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/event_listeners.js:132:42)
at Request.callListeners (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at callNextListener (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at /var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/event_listeners.js:86:9
at finish (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/config.js:386:7)
at /var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/config.js:404:9 {
code: 'UnexpectedParameter',
time: 2020-09-03T16:06:47.127Z
},
UnexpectedParameter: Unexpected key 'dbClusterOrInstanceArn' found in params
at ParamValidator.fail (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:50:37)
at ParamValidator.validateStructure (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:77:14)
at ParamValidator.validateMember (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:88:21)
at ParamValidator.validate (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/param_validator.js:34:10)
at Request.VALIDATE_PARAMETERS (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/event_listeners.js:132:42)
at Request.callListeners (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at callNextListener (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at /var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/event_listeners.js:86:9
at finish (/var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/config.js:386:7)
at /var/task/lambda_layer/nodejs/node_modules/aws-sdk/lib/config.js:404:9 {
code: 'UnexpectedParameter',
time: 2020-09-03T16:06:47.127Z
}
],
time: 2020-09-03T16:06:47.128Z
}
END RequestId: 4cff164c-7c7a-477f-9feb-8485813681a0
REPORT RequestId: 4cff164c-7c7a-477f-9feb-8485813681a0 Duration: 52.38 ms Billed Duration: 100 ms Memory Size: 320 MB Max Memory Used: 84 MB Init Duration: 525.83 ms