Skip to content

Commit

Permalink
Add FAQ item about context.done called twice warning (#481)
Browse files Browse the repository at this point in the history
Co-authored-by: Pedro Resch <pedro@agenciaatom.com.br> [ci skip]
  • Loading branch information
rschpdr authored Mar 7, 2020
1 parent a9adee5 commit 2bcb78a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,13 @@ methods to allow you to quickly hook in simple inline middlewares.
Check the [code for existing middlewares](/src/middlewares) to see more examples
on how to write a middleware.
## FAQ
### Q: `context.done called twice within handler` warning
**A**: You're probably trying to use `callback()` inside an async handler, or `next()` inside an async middleware. Async
handlers and middlewares should return a promise, so calling those functions is not needed.
See [Promise support](https://github.com/middyjs/middy#promise-support) for examples.
## Available middlewares
Currently available middlewares:
Expand Down

0 comments on commit 2bcb78a

Please sign in to comment.