Skip to content

SQS handlers fail after upgrading from 4.10.4 to 4.14.0 #679

@vubogovich

Description

@vubogovich

We use res.sendStatus(200) in SQS handlers and that started to trigger the following error with minor upgrade of the package.

{
  "errorType": "Runtime.UnhandledPromiseRejection",
  "errorMessage": "SyntaxError: Unexpected token 'O', \"OK\" is not valid JSON",
  "reason": {
    "errorType": "SyntaxError",
    "errorMessage": "Unexpected token 'O', \"OK\" is not valid JSON",
    "stack": [
      "SyntaxError: Unexpected token 'O', \"OK\" is not valid JSON",
      "    at JSON.parse (<anonymous>)",
      "    at Object.getResponseToSqs [as getResponse] (/opt/nodejs/node_modules/@codegenie/serverless-express/src/event-sources/aws/sqs.js:13:45)",
      "    at forwardResponse (/opt/nodejs/node_modules/@codegenie/serverless-express/src/transport.js:33:39)",
      "    at forwardRequestToNodeServer (/opt/nodejs/node_modules/@codegenie/serverless-express/src/transport.js:160:3)",
      "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
    ]
  },
  "promise": {},
  "stack": [
    "Runtime.UnhandledPromiseRejection: SyntaxError: Unexpected token 'O', \"OK\" is not valid JSON",
    "    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)",
    "    at process.emit (node:events:518:28)",
    "    at emit (node:internal/process/promises:150:20)",
    "    at processPromiseRejections (node:internal/process/promises:284:27)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"
  ]
}

In case of res.sendStatus(204) the error message is SyntaxError: Unexpected end of JSON input.

I think it's related to #628.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions