title: S3 trigger failes to update table in DynamoDB
body: <p>I have created a web app in AWS Amplify. A web page uploads a file to an S3 bucket. I have created a trigger that should create a record in DynamoDB for each uploaded file. My trigger code is called, there are no errors I can find anywhere but the table is not updated.</p>
  <p>The trigger code:</p>
  <pre><code>exports.handler = async function (event) {
    console.log('Received S3 event:', JSON.stringify(event, null, 2));
    // Get the object from the event and show its content type
    const eventName = event.Records[0].eventName;
    const bucket = event.Records[0].s3.bucket.name; //eslint-disable-line
    let key = event.Records[0].s3.object.key.replace('%3A', ':');
    const imgSize = event.Records[0].s3.object.size;
    console.log(`Bucket: ${bucket}`, `Key: ${key}`);
  
    if (eventName === &quot;ObjectCreated:Put&quot;) {
      console.log(&quot;This is a put event&quot;)
      addDBActivity(key);
     }
  };
  
  var AWS = require('aws-sdk');
  var ddb = new AWS.DynamoDB();
  
  function addDBActivity(key) {
    console.log(&quot;in addDBActivity&quot;);
  //  let activityTable = &quot;Activity-***-dev&quot;
    let activityTable = &quot;Activity-ctuqkflvhvbjxftdvdo64xnzle-dev&quot;
    let name = key.split('/').pop();
    let owner = key.split('/')[0];
    let format = &quot;tcx&quot;;
    let type = &quot;cycling&quot;;
    var params = {
      TableName: activityTable,
      Item: {
        key: { S: key },
        name: { S: name },
        owner: { S: owner },
        format: { S: format },
        type: { S: type },
      }
    };
  
    console.log(params);
  
    ddb.putItem(params).promise()
    .then(function(data) {
      console.log(data);
    })
    .catch(function(err) {
      console.log(err);
    });
  
    console.log(&quot;after promise&quot;);
  }
  </code></pre>
  <p>schema.graphql</p>
  <pre><code>type Activity @model @auth(rules: [
      { allow: owner, ownerField: &quot;id&quot; }
    ]) {
    id: ID!
    name: String!
    owner: String!
    key: String!
    format: String!
    type: String!
  }
  </code></pre>
  <p>After uploading a file this is the log output in CloudWatch:</p>
  <pre><code>2021-12-18T13:14:26.093+02:00
  2021-12-18T11:14:26.092Z    20cf4afe-3c96-4ee2-94c6-7c12c27c4d66    INFO    This is a put event
      2021-12-18T11:14:26.092Z 20cf4afe-3c96-4ee2-94c6-7c12c27c4d66 INFO This is a put event
      2021-12-18T13:14:26.093+02:00
  2021-12-18T11:14:26.093Z    20cf4afe-3c96-4ee2-94c6-7c12c27c4d66    INFO    in addDBActivity
      2021-12-18T11:14:26.093Z 20cf4afe-3c96-4ee2-94c6-7c12c27c4d66 INFO in addDBActivity
      2021-12-18T13:14:26.123+02:00
  2021-12-18T11:14:26.123Z    20cf4afe-3c96-4ee2-94c6-7c12c27c4d66    INFO    {
    TableName: 'Activity-ctuqkflvhvbjxftdvdo64xnzle-dev',
    Item: {
      key: {
        S: 'public/sourb/ramp_test2tcx-a03e6380-e0c3-4966-b4eb-b74375f930bd.tcx'
      },
      name: { S: 'ramp_test2tcx-a03e6380-e0c3-4966-b4eb-b74375f930bd.tcx' },
      owner: { S: 'public' },
      format: { S: 'tcx' },
      type: { S: 'cycling' }
    }
  }
      2021-12-18T11:14:26.123Z 20cf4afe-3c96-4ee2-94c6-7c12c27c4d66 INFO { TableName: 'Activity-ctuqkflvhvbjxftdvdo64xnzle-dev', Item: { key: { S: 'public/sourb/ramp_test2tcx-a03e6380-e0c3-4966-b4eb-b74375f930bd.tcx' }, name: { S: 'ramp_test2tcx-a03e6380-e0c3-4966-b4eb-b74375f930bd.tcx' }, owner: { S: 'public' }, format: { S: 'tcx' }, type: { S: 'cycling' } } }
      2021-12-18T13:14:26.542+02:00
  2021-12-18T11:14:26.522Z    20cf4afe-3c96-4ee2-94c6-7c12c27c4d66    INFO    after promise
  </code></pre>
  <p>Any idea what could be the issue?</p>