dynamodb-geo.js
dynamodb-geo.js copied to clipboard
One or more parameter values were invalid: ComparisonOperator BETWEEN is not valid for M AttributeValue type
I am integrating this Library with my Lambda function written in node.js.
Here is my code
`const AWS = require('aws-sdk'); const ddbGeo = require('dynamodb-geo');
const MESSAGES_TABLE = process.env.MESSAGES_TABLE; const AWS_DEPLOY_REGION = process.env.AWS_DEPLOY_REGION;
const dynamoDb = new AWS.DynamoDB.DocumentClient({ api_version: '2012-08-10', region: AWS_DEPLOY_REGION });
const config = new ddbGeo.GeoDataManagerConfiguration(dynamoDb, MESSAGES_TABLE); const myGeoTableManager = new ddbGeo.GeoDataManager(config);
//and here is my Lambda function
module.exports.fetchNearByUsers = async (event, context) => {
const params = {
TableName: MESSAGES_TABLE
};
try {
return myGeoTableManager.queryRadius({
RadiusInMeter: 100000,
CenterPoint: {
latitude: 52.225730,
longitude: 0.149593
}
})
} catch (error) {
return {
statusCode: 400,
error: Could not fetch: ${error.stack}
};
}
};`
Whenever I test my Lambda Function from AWS console. I am getting this error.
{
"errorMessage": "One or more parameter values were invalid: ComparisonOperator BETWEEN is not valid for M AttributeValue type",
"errorType": "ValidationException",
"stackTrace": [
"Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:48:27)",
"Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)",
"Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
"Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)",
"Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
"AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
"/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
"Request.
@rh389 Hi, Can you please look into the Issue. Any help would be appreciated . :)
I am running into this same issue as well.
@kashifaliquazi Figured out where we went wrong. You're passing in a document_client to the GeoDataManagerConfiguration function. It needs to be a DynamoDb object.