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

Unexpected message handler failure: done is not a function #182

Closed
geremyCohen opened this issue Aug 22, 2019 · 6 comments
Closed

Unexpected message handler failure: done is not a function #182

geremyCohen opened this issue Aug 22, 2019 · 6 comments
Assignees
Labels

Comments

@geremyCohen
Copy link

When running this snippet:

const app = Consumer.create({
  queueUrl: SQS_QUEUE_URL,
  region: 'us-east-1',
  batchSize: 10,
  handleMessage: function (message, done) {

    console.log(done);
    console.log(message);// do some work with `message`
    done();
  }
});

I can console.log the message, however I get the error:

Unexpected message handler failure: done is not a function

I am running on Ubuntu 18.04, node 10.16.3.

Any ideas?

@nspragg nspragg self-assigned this Aug 23, 2019
@nspragg nspragg added the triage label Aug 23, 2019
@nspragg
Copy link
Contributor

nspragg commented Aug 23, 2019

@geremyCohen - What version of the sqs-consumer are you using? Callback support was dropped from version 4.x.x onwards.

@geremyCohen
Copy link
Author

I am using 5.3.0. I tried using the boilerplate from the home page:

const app = Consumer.create({
  queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name',
  handleMessage: async (message) => {
    // do some work with `message`
  }
});

And the messages arrive intermittently (vs my vanilla AWS SDK-based prototype.)

In the docs, it says "Messages are deleted from the queue once the handler function has completed successfully." but I wasn't clear on what I had to do in the handler to signal a "success" (if anything).

@rey-narvaez
Copy link

rey-narvaez commented Aug 23, 2019

@geremyCohen - What version of the sqs-consumer are you using? Callback support was dropped from version 4.x.x onwards.

So how do you manage retries in the newer versions?

On previous versions you could run "done(err)" and this will not delete the message from the queue.

@nspragg
Copy link
Contributor

nspragg commented Sep 13, 2019

Unable to replicate this issue. Closing due to inactively. If you wish to continue this discussion, we can re-open.

@nspragg nspragg closed this as completed Sep 13, 2019
@BravoNatalie
Copy link

I am using 5.3.0. I tried using the boilerplate from the home page:

const app = Consumer.create({
  queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name',
  handleMessage: async (message) => {
    // do some work with `message`
  }
});

And the messages arrive intermittently (vs my vanilla AWS SDK-based prototype.)

In the docs, it says "Messages are deleted from the queue once the handler function has completed successfully." but I wasn't clear on what I had to do in the handler to signal a "success" (if anything).

I'm having the same doubt, how can I signal the success or failure in the handler function?

@emiliosa
Copy link

emiliosa commented Nov 7, 2024

@nspragg same issue here Unexpected message handler failure: timeout of 10000ms exceeded

version:

 sqs-consumer:
    specifier: ^11.2.0
    version: 11.2.0(@aws-sdk/[email protected])`

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

No branches or pull requests

5 participants