Answer the question
In order to leave comments, you need to log in
How to filter records in DynamoDB?
I have the following lambda function:
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
AWS.config.update({
region: "eu-central-1"
});
exports.handler = (event, context, callback) => {
const dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});
dynamodb.query({
TableName: 'ToneySounds',
ProjectionExpression:"soundUuid, #c,#n",
KeyConditionExpression: '#n = :n',
ExpressionAttributeValues: {
':n': {S: 'filename'},
},
ExpressionAttributeNames:{
"#n": "name",
"#c": "collection"
},
}, function(err, data) {
if (err) {
console.log(err, err.stack);
callback(null, {
statusCode: '500',
body: err + err.stack
});
} else {
callback(null, {
statusCode: '200',
body: JSON.stringify(data.Items)
});
}
});
};
{
"a": {
"N": "1"
},
"collection": {
"S": "CollectionName"
},
"name": {
"S": "filename"
},
"path": {
"S": "CollectionName/filename%5Btag1%2Ctag2%2Casdasd%5D.jpg"
},
"soundUuid": {
"S": "1351028e-db98-4e19-a0b2-39125b7ac5d8"
},
"tags": {
"SS": [
"asdasd",
"tag1",
"tag2"
]
}
}
ResourceNotFoundException: Requested resource not found
Answer the question
In order to leave comments, you need to log in
The error has nothing to do with the filter: The table has not been created, is in the process of being created, or is corny in the wrong region
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question