Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports.handler = async function(event, context, callback) {
- try {
- const Bucket = event.Records[0].s3.bucket.name;
- const Key = event.Records[0].s3.object.key;
- console.log('Bucket', Bucket);
- console.log('Key', Key);
- const objectHead = await s3.headObject({ Bucket, Key }).promise();
- console.log('Alas! I will never discover that the objectHead is:', objectHead);
- callback();
- } catch(err) {
- console.error('Error', err);
- callback(err);
- }
- }
- {
- NotFound: null
- message: null,
- code: 'NotFound',
- region: null,
- time: 2018-02-19T11:06:35.894Z,
- requestId: 'XXXXXXXXXXX',
- extendedRequestId: 'XXX.....XXX',
- cfId: undefined,
- statusCode: 404,
- retryable: false,
- retryDelay: 77.24564264820208
- }
- const s3 = new AWS.S3({
- region: 'us-east-1'
- });
Add Comment
Please, Sign In to add comment