Created
September 19, 2020 17:10
-
-
Save kylenstone/c652d23b70e5a2381c46124ddb688656 to your computer and use it in GitHub Desktop.
Frame.io Custom Action Backup to S3 Code: Lambda #2
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 { 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