Receiving TypeError: AWS.RDSDataService Is Not A Constructor
Attempting to use the RDSDataService in AWS Lambda as follows:
const AWS = require('aws-sdk');
AWS.config.update({
region: 'us-east-1'
})
AWS.config.apiVersions = {
rdsdataservice: '2018-08-01',
// other service API versions
};
const rdsdataservice = new AWS.RDSDataService();
exports.handler = function(event, context, callback) {
callback(null, 'ok')
};
And receiving error:
"errorMessage": "AWS.RDSDataService is not a constructor", "errorType": "TypeError", "stackTrace": [ "Module._compile (module.js:652:30)", "Object.Module._extensions..js (module.js:663:10)", "Module.load (module.js:565:32)", "tryModuleLoad (module.js:505:12)", "Function.Module._load (module.js:497:3)", "Module.require (module.js:596:17)", "require (internal/module.js:11:18)"
Nodejs version: 8.10
Any idea what's going on? I've set region and API version
Answer
It have to works with the latest aws-sdk package.
You can check the package version with this command:
npm show aws-sdk version
You can check the released versions here: https://www.npmjs.com/package/aws-sdk
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error