in amplify/backend/function/S3Trigger984fb593/src/index.js [84:113]
async function processRecord(record) {
const bucketName = record.s3.bucket.name;
const key = decodeURIComponent(record.s3.object.key.replace(/\+/g, " "));
const id = key.split('/').pop().split(".")[0]
console.log('processRecord', JSON.stringify(record))
if (!key.includes('upload')) {
console.log('Does not look like an upload from user');
return;
}
const SfnExecutionArn = await startSfnExecution(bucketName, key, id);
console.log(`Sfn started. Execution: ${SfnExecutionArn}`)
const item = {
id,
SfnExecutionArn,
ProcessingStatus: 'RUNNING'
}
console.log('update photo item: ', JSON.stringify(item, null, 2))
const result = await client.mutate({
mutation: UPDATE_PHOTO_MUTATION,
variables: {input: item},
fetchPolicy: 'no-cache'
})
console.log('result', JSON.stringify(result))
return result
}