Last active
May 21, 2018 00:48
-
-
Save starpebble/5dcba9e4387fe50e7e4cb1b7e480489e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const dynamodb = new AWS.DynamoDB(); | |
dynamodb.endpoint = 'http://host.docker.internal:8000'; | |
exports.handler = async (event) => { | |
return new Promise((resolve, reject) => { | |
console.log('🏄 edge greenery lambda function invoked'); | |
const params = { | |
'TableName': 'edge-greenery-table', | |
}; | |
dynamodb.scan(params, (err, data) => { | |
if (err) { | |
throw new Error('❌ Edge Greenery failed to connect to DynamoDB.'); | |
} | |
else { | |
if (data.Items.length) { | |
resolve('Edge Greenery Found Data!'); | |
} else { | |
throw new Error('❌ There is something wrong with this lambda.'); | |
} | |
} | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment