title: AWS SQS SendMessage isn't working with serverless-offline-sqs
body: <p>I'm working with serverless, porting two functions, one (call it generator) that is currently a long-running node process and the other (call it checker) triggered by cron, so that they both would be lambdas, checker triggered by a schedule, and generator by receiving an SQS notification.  I'm also a big fan of being able to do local dev, so added serverless-offline and serverless-offline-sqs (backed by ElasticMQ).</p>
  <p>Ported the generator, and it deploys and runs just fine locally.  Here's the function as defined in serverless.yml:</p>
  <pre><code>  reportGenerator:
      handler: src/reportGenerator.handleReportRequest
      events:
        - sqs:
            arn:
              Fn::GetAtt:
                - ReportRequestQueue
                - Arn
  </code></pre>
  <p>I can use the AWS CLI to trigger messages through ElasticMQ (aws account # obfuscated):</p>
  <pre><code>$ aws sqs send-message --queue-url https://sqs.us-west-1.amazonaws.com/000000000000/local-report-request --message-body file://./test/reportGenerator/simple_payload.json --endpoint-url http://localhost:9324
  {
      &quot;MD5OfMessageBody&quot;: &quot;267bd9129a76e3f48c26903664824c13&quot;,
      &quot;MessageId&quot;: &quot;12034cd8-3783-403a-92eb-a5935c8759ae&quot;
  }
  $
  </code></pre>
  <p>And the message is received fine, the generator lambda triggers:</p>
  <pre><code>{
    &quot;requestId&quot;: &quot;ckokpja2e0001nbyocufzdrxk&quot;,
    &quot;function&quot;: &quot;src/reportGenerator.js::exports:14&quot;,
    &quot;level&quot;: &quot;info&quot;,
    &quot;message&quot;: &quot;Found 0 waiting report request(s)&quot;
  }
  offline: (λ: reportGenerator) RequestId: ckokpja2e0001nbyocufzdrxk  Duration: 214.53 ms  Billed Duration: 215 ms
  </code></pre>
  <p>Now I want to do that SQS send programmatically for the second function, which is pretty much the only real change to that existing (non-lambda) function.  It is also deployed/launched just fine, but the aws-sdk library function to send the same message isn't working.</p>
  <p>Here's the function definition in serverless.yml.  Note that I commented out the normal cron schedule, since that isn't supported by serverless-offline, and just used the 10 minute rate for testing:</p>
  <pre><code>  reportChecker:
      handler: src/reportScheduler.check
      environment:
        REPORT_REQUEST_QUEUE_URL: &quot;https://sqs.us-west-1.amazonaws.com/${self:custom.awsAccountId}/${opt:stage, self:custom.defaultStage}-report-request&quot;
      events:
        # note that cron does not work for offline.  Comment these out, and uncomment the rate to test locally
        # - schedule: 
        #     rate: cron(0 11 ? * 3 *)
        #     input:
        #       reportType: weekly
        # - schedule: 
        #     rate: cron(0 11 2 * ? *)
        #     input:
        #       reportType: monthly
        - schedule: 
            rate: rate(10 minutes)
            input:
              reportType: weekly
  
  </code></pre>
  <p>Here's what I added to the rest of the function as the node version of the above command line:</p>
  <pre><code>const AWS = require('aws-sdk');
  AWS.config.update({region: process.env.AWS_REGION});
  
  ...
  
      try {
        const sqs = new AWS.SQS({endpoint: 'http://localhost:9324'});
        logger.debug('SQS info', {queueUrl: process.env.REPORT_REQUEST_QUEUE_URL, endpoint: sqs.endpoint});
        await sqs.sendMessage({
            QueueUrl: process.env.REPORT_REQUEST_QUEUE_URL,
            MessageBody: `{&quot;reportType&quot;:${checkType}}`
          })
          .promise();
      }
      catch(err) {
        logger.error('SQS failed to send', {error: err});
      }
  </code></pre>
  <p>The output from those logger statements is</p>
  <pre><code>{
    &quot;requestId&quot;: &quot;ckokpulxw0002nbyo19sj87g2&quot;,
    &quot;function&quot;: &quot;src/reportScheduler.js::exports:100&quot;,
    &quot;data&quot;: {
      &quot;queueUrl&quot;: &quot;https://sqs.us-west-1.amazonaws.com/000000000000/local-report-request&quot;,
      &quot;endpoint&quot;: {
        &quot;protocol&quot;: &quot;http:&quot;,
        &quot;host&quot;: &quot;localhost:9324&quot;,
        &quot;port&quot;: 9324,
        &quot;hostname&quot;: &quot;localhost&quot;,
        &quot;pathname&quot;: &quot;/&quot;,
        &quot;path&quot;: &quot;/&quot;,
        &quot;href&quot;: &quot;http://localhost:9324/&quot;
      }
    },
    &quot;level&quot;: &quot;debug&quot;,
    &quot;message&quot;: &quot;SQS info&quot;
  }
  {
    &quot;requestId&quot;: &quot;ckokpulxw0002nbyo19sj87g2&quot;,
    &quot;function&quot;: &quot;src/reportScheduler.js::exports:109&quot;,
    &quot;data&quot;: {
      &quot;error&quot;: {
        &quot;message&quot;: &quot;The specified queue does not exist for this wsdl version.&quot;,
        &quot;code&quot;: &quot;AWS.SimpleQueueService.NonExistentQueue&quot;,
        &quot;time&quot;: &quot;2021-05-12T00:20:00.497Z&quot;,
        &quot;requestId&quot;: &quot;e55124c3-248e-5afd-acce-7dd605fe1fe5&quot;,
        &quot;statusCode&quot;: 400,
        &quot;retryable&quot;: false,
        &quot;retryDelay&quot;: 95.52839314049268
      }
    },
    &quot;level&quot;: &quot;error&quot;,
    &quot;message&quot;: &quot;SQS failed to send&quot;
  }
  offline: (λ: reportChecker) RequestId: ckokpulxw0002nbyo19sj87g2  Duration: 477.95 ms  Billed Duration: 478 ms
  </code></pre>
  <p>It sure looks to me like the code is using all the same values as the command line, but it just isn't working.  Hoping someone else can see something obvious here.</p>
  <p>Thanks.</p>