Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serverless-offline-sqs breaks when upgrading @aws-sdk from 3.226.0 to 3.556.0 #260

Open
serg06 opened this issue Apr 22, 2024 · 2 comments

Comments

@serg06
Copy link

serg06 commented Apr 22, 2024

Library version:

serverless-offline-sqs": "^7.3.2"

Breaking code:

  await sqs.send(
    new SendMessageCommand({
      MessageBody: JSON.stringify(data),
      QueueUrl: Config.TASKS_QUEUE_URL,
    })
  );

Stack trace:

SyntaxError: Unexpected token < in JSON at position 0\n  Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
    at JSON.parse (<anonymous>)
    at C:\\repo\\mono\\node_modules\\@aws-sdk\\core\\dist-cjs\\index.js:323:19
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at parseJsonErrorBody (C:\\repo\\mono\\node_modules\\@aws-sdk\\core\\dist-cjs\\index.js:336:17)
    at de_CommandError (C:\\repo\\mono\\node_modules\\@aws-sdk\\client-sqs\\dist-cjs\\index.js:1191:11)
    at C:\\repo\\mono\\node_modules\\@smithy\\middleware-serde\\dist-cjs\\index.js:35:20
    at C:\\repo\\mono\\node_modules\\@smithy\\core\\dist-cjs\\index.js:165:18
    at C:\\repo\\mono\\node_modules\\@smithy\\middleware-retry\\dist-cjs\\index.js:320:38
    at C:\\repo\\mono\\node_modules\\@aws-sdk\\middleware-sdk-sqs\\dist-cjs\\index.js:130:16
    at C:\\repo\\mono\\node_modules\\@aws-sdk\\middleware-logger\\dist-cjs\\index.js:33:22
    at {the code I linked above}

What it's trying to parse:

<!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

How I tried fixing it:

  • Upgrading to serverless-offline-sqs 8.0.0. The error above just turned into an "UnknownError" instead.
@serg06 serg06 changed the title Breaks when upgrading @aws-sdk from 3.226.0 to 3.556.0 serverless-offline-sqs breaks when upgrading @aws-sdk from 3.226.0 to 3.556.0 Apr 22, 2024
@serg06
Copy link
Author

serg06 commented Apr 22, 2024

Do I need to update my localstack which is running sqs? It's running a pretty old version

@tanguybernard
Copy link

Hello, I have almost same issue with different dependencies

SyntaxError: Unexpected token 'T', "There was "... is not valid JSON
  Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
    at JSON.parse (<anonymous>)

My dependencies:

"serverless": "^3.38.0",
"serverless-offline": "^13.6.0",
"serverless-offline-sqs": "^8.0.0",
"serverless-plugin-typescript": "^2.1.5",
"ts-node": "^10.9.2",
"tsx": "^4.11.2",
"typescript": "^5.4.5"

"@aws-sdk/client-lambda": "^3.504.0",
"@aws-sdk/client-sqs": "^3.226.0",
"@aws-sdk/lib-dynamodb": "^3.587.0",
"aws-sdk": "^2.1634.0"

Its working with aws-sdk (v2) but not with @aws-sdk/client-sqs (v3)

If someone has a clue ?? I can help myself but I don't know where to look !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants