title: Unexpected end of JSON input error in AWS Lambda SQS function
body: <p>This is my nodejs app serverless lambda function</p>
  <pre><code>export const updateDailyForecastResults: SQSHandler = async (event) =&gt; {
    console.log('Function invoked!!!!');
    await env.check();
    event.Records.forEach(record =&gt; {
      const { body } = record;
      console.log(body);
    });
    return;
  }; 
  </code></pre>
  <p>And I am sending was document example sqs event</p>
  <pre><code>{
    &quot;Records&quot;: [
      {
        &quot;messageId&quot;: &quot;059f36b4-87a3-44ab-83d2-661975830a7d&quot;,
        &quot;receiptHandle&quot;: &quot;AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a...&quot;,
        &quot;body&quot;: &quot;test&quot;,
        &quot;attributes&quot;: {
          &quot;ApproximateReceiveCount&quot;: &quot;1&quot;,
          &quot;SentTimestamp&quot;: &quot;1545082649183&quot;,
          &quot;SenderId&quot;: &quot;AIDAIENQZJOLO23YVJ4VO&quot;,
          &quot;ApproximateFirstReceiveTimestamp&quot;: &quot;1545082649185&quot;
        },
        &quot;messageAttributes&quot;: {},
        &quot;md5OfBody&quot;: &quot;098f6bcd4621d373cade4e832627b4f6&quot;,
        &quot;eventSource&quot;: &quot;aws:sqs&quot;,
        &quot;eventSourceARN&quot;: &quot;arn:aws:sqs:us-east-2:123456789012:my-queue&quot;,
        &quot;awsRegion&quot;: &quot;us-east-2&quot;
      }
    ]
  }
  </code></pre>
  <p>Or I tried other versions of Json objects but always I got the same error which is</p>
  <pre><code>{
    &quot;errorType&quot;: &quot;Runtime.UserCodeSyntaxError&quot;,
    &quot;errorMessage&quot;: &quot;SyntaxError: Unexpected end of JSON input&quot;,
    &quot;trace&quot;: [
      &quot;Runtime.UserCodeSyntaxError: SyntaxError: Unexpected end of JSON input&quot;,
      &quot;    at _loadUserApp (/var/runtime/UserFunction.js:98:13)&quot;,
      &quot;    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)&quot;,
      &quot;    at Object.&lt;anonymous&gt; (/var/runtime/index.js:43:30)&quot;,
      &quot;    at Module._compile (internal/modules/cjs/loader.js:1015:30)&quot;,
      &quot;    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)&quot;,
      &quot;    at Module.load (internal/modules/cjs/loader.js:879:32)&quot;,
      &quot;    at Function.Module._load (internal/modules/cjs/loader.js:724:14)&quot;,
      &quot;    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)&quot;,
      &quot;    at internal/main/run_main_module.js:17:47&quot;
    ]
  }
  </code></pre>
  <p>Please can anyone help me?</p>