title: AWS: No Messages Available When Sending Message to SQS Queue from Lambda
body: <p>What are some possible reasons why the following is not working for me?</p>
  
  <ol>
  <li>Create a DynamoDB table <code>card_auth_events</code> with at least an <code>id</code> field.</li>
  <li>Create a trigger that calls a lambda. Here is the lambda: </li>
  </ol>
  
  
  
  <pre><code> console.log('Loading publishCardAuthEvent...');
  
   var QUEUE_URL = 'https://sqs.us-west2.amazonaws.com/XXXXXXXXXXXX/CardAuthEvents';
   var AWS = require('aws-sdk');
   var sqs = new AWS.SQS({region : 'us-west-2'});
   var http = require('https');
  
   exports.handler = function(event, context) {
   event.Records.forEach(function(record) {
        console.log(record.eventID);
        console.log(record.eventName);
        console.log('DynamoDB Record: %j', record.dynamodb);
        sendToQueue(record);
   });
   context.succeed("Successfully processed " + event.Records.length + " records.");
  };
  
  function sendToQueue(message){
  //Send SQS message with details of file uploaded to S3.
  var params = {
    MessageBody: JSON.stringify(event),
    QueueUrl: QUEUE_URL
  };
  
  sqs.sendMessage(params, function(err,data){
    if (err) {
      console.log('error:',"Fail Send Message" + err);
      context.done('error', "ERROR Put SQS");  // ERROR with message
  
      } else {
        console.log('data:',data.MessageId);
        context.done(null,'');  // SUCCESS
      }
    });
  }
  </code></pre>
  
  <ol start="3">
  <li><p>Configure the Lambda to have a role with <code>AmazonSQSFullAccess</code>, <code>AmazonDynamoDBFullAccess</code>, and <code>AmazonAppStreamFullAccess</code>.</p></li>
  <li><p>Create the Queue in SQS</p></li>
  <li><p>Insert a record into the table.</p></li>
  </ol>
  
  <p><strong>The trigger is getting called, but why is the message not put in the Queue???</strong></p>
  
  <p>There are no messages in the queue and no errors in Cloud Watch. Is there some secret I am missing?</p>