Open ShaneC-C-Y opened 8 years ago
Hi there, I am new to this module. I have a problem when using mock-awe with dynamodb I found this doesn't support dynamodb DocumentClient.
The test.js
var AWS = require('mock-aws'), expect = require('chai').expect, get_info = require('../get_info'); const context = require('aws-lambda-mock-context'); const ctx = context(); ... var testData = require('./testData.json') AWS.mock('DynamoDB.DocumentClient', 'scan', testData); get_info.handler({}, ctx, function(err, data){ ... }); ...
The following is get_info.js
var AWS = require("aws-sdk"); AWS.config.update({ region: "us-west-2", }); exports.handler = (event, context, callback) => { var docClient = new AWS.DynamoDB.DocumentClient(); var params = { TableName:table, ProjectionExpression: "deltaEndpoint, tag" } docClient.scan(params, onScan); function onScan(err, data) { .... } };
This will return TypeError: Cannot read property 'clients' of undefined
TypeError: Cannot read property 'clients' of undefined
But it can work if I use
var db = new AWS.DynamoDB(); db.scan(params, onScan);
Is there any way to fix this problem?
I'm having this problem too. I'm using aws-sdk 2.2.20 and mock-aws 1.2.3
We also have this problem.
I'm encountering the same issue.
Hi there, I am new to this module. I have a problem when using mock-awe with dynamodb I found this doesn't support dynamodb DocumentClient.
The test.js
The following is get_info.js
This will return
TypeError: Cannot read property 'clients' of undefined
But it can work if I use
Is there any way to fix this problem?