-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Context doesn't work with passport #13
Comments
Thanks for the feedback 😄 What version of passport and what version of node are you using? |
node - v8.11.3 thank you for quick feedback |
I forked passport's Express 4 example app and added My steps to test:
I observed the following console output which indicates that I did not do enough to reproduce your error:
Things that will help me at this point:
(The last option would be the most helpful, but I also understand that it will be the most effort for you) |
Hi there, I also have an issue using passport (0.4.0, passport-local 1.0.0) with express-http-context and just tested your example with different versions of nodejs (10.15.0, 10.15.3, 8.11.3).
As you can see, the context get's lost within the POST /login route. If I use GET for the /login route, everything is fine. Btw, a POST route without password.authenticate causes the same problem. Any clue what's going here? Cheers |
Got it working by adding bindEmitter calls right before the first context.set:
|
Having the same issue with passport after the authentication middleware being applied. Using: |
for anyone else having trouble: while the behavior I observed was not that context was not available, I did notice several requests sharing context when they should be independent under concurrent requests. my test setup used a cluster of 50 workers hitting an authorized endpoint sequentially 5 times each. in my testing, usually between 200 and 220 unique contexts were created (tested by storing a uuid on the context) when there should have been 250. the way I resolved this was by promisifying passport.authenticate. rather than doing
I did something like this:
Since express-http-context and cls-hooked us async_hooks under the hood, the tip to promisify callback style functions helped a lot: |
after
context is not works
The text was updated successfully, but these errors were encountered: