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

callback called two times on error #8

Open
paolini opened this issue Aug 31, 2017 · 2 comments
Open

callback called two times on error #8

paolini opened this issue Aug 31, 2017 · 2 comments

Comments

@paolini
Copy link

paolini commented Aug 31, 2017

callback(error);

when dynamoDb.scan gives an error, both callback(error) and callback(error, data.Items) get called.

In my case the database is giving an error (AccessDeniedError) and since data is null the code breaks in data.Items and the error is hidden.

I think that a return statement must be added in the if(error) case.

@paolini
Copy link
Author

paolini commented Aug 31, 2017

If I can add a question (this is my first experience with aws lambda) why is that when callback(error) gets called with a non empty error, the error gets logged but the user making the request is getting an empty response (I would expect an error response also there per http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-mode-exceptions.html )

@reergymerej
Copy link

reergymerej commented Sep 14, 2017

PR #7 addresses this.

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