Skip to content

Instantly share code, notes, and snippets.

@kylenstone
Created September 19, 2020 17:10
Show Gist options
  • Save kylenstone/c652d23b70e5a2381c46124ddb688656 to your computer and use it in GitHub Desktop.
Save kylenstone/c652d23b70e5a2381c46124ddb688656 to your computer and use it in GitHub Desktop.
Frame.io Custom Action Backup to S3 Code: Lambda #2
const { s3Uploader } = require('./modules/api');
exports.handler = async (event) => {
let { caller, firstLambdaTraceID, url, name } = event;
// Logs for convenient searching in X-Ray and CloudWatch
console.log(`Second Lambda trace ID: ${process.env._X_AMZN_TRACE_ID}`);
console.log(`Called by ${caller} with trace ID: ${firstLambdaTraceID}. Begin uploading ${name}...`);
try {
await s3Uploader(url, name);
} catch(err) {
return (`error: ${err}`);
}
return (console.log(`Done uploading ${name}!`));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment