I have been trying to implement DynamoDB using Javascript. When I used, AWS.config.update='my_region', I'm getting "uncaught referenceerror: AWS in not defined". I have declared AWS globally.
Note: aws.sdk.js has been implemented
If you are using node.js
aws sdk, you should include the require
.
var AWS = require("aws-sdk");
var creds = new AWS.Credentials('akid', 'secret', 'session');
AWS.config.update({
region: "us-west-2",
endpoint: "http://localhost:8000",
credentials: creds
});
If you are using JavaScript in HTML
, please include the SDK.
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.12.min.js"></script>
If the above solution doesn't resolve the issue, please show your full code to look at your scenario specifically.
Javascript Example
One Crucial Mistake I was doing is not to add<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.12.min.js"></script>
this line in my html code(for front-end side in angular2). If you are using NodeJS then you have to add this file by using npm install aws-sdk
.
You can find this information in this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With