Global Middleware not respecting next()
See original GitHub issueDescription
Applying global middleware via app.use
seems to pass control to the next part of the chain before next()
is called.
Example:
module.exports = function(app) {
app.use(function(payload, user){
console.log('This comment should print and then timeout')
})
app.command("/pilot", slashCommand);
};
This should fail however control seems to pass correctly to the command. What am I missing?
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
- I’ve read and agree to the Code of Conduct.
- I’ve searched for any related issues and avoided creating a duplicate issue.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Advanced Features: Middleware - Next.js
Middleware allows you to run code before a request is completed, then based on the incoming request, you can modify the response by...
Read more >express global middleware not being called - node.js
I expect to see "inside middleware", then "inside route". Instead, I just see "inside route". is specific to error handling middleware.
Read more >Using middleware - Express.js
If the current middleware function does not end the request-response cycle, it must call next() to pass control to the next middleware function....
Read more >Middleware - Laravel - The PHP Framework For Web Artisans
The withoutMiddleware method can only remove route middleware and does not apply to global middleware. Middleware Groups. Sometimes you may want to group ......
Read more >Middleware | NestJS - A progressive Node.js framework
if the current middleware function does not end the request-response cycle, it must call next() to pass control to the next middleware function....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
👋 I’ve submitted a PR (#394) with a test case for this issue and a proposed fix.
In the meantime, since only the last global middleware exhibits this behavior, a simple workaround is to add a no-op global middleware after all other global middleware. (This workaround also addresses the issue with async conversation stores)