You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passport.js is used with session:false the async context is lost and rTracer.id() stops returning an ID. I'm pretty sure this a similar issue as described in the README and #20. That said, it seems to be something slightly different, given that #20 is an issue with express-session and I've explicitly disabled sessions here.
Specifically I'm using passport.js configured to accept JWTs with passport-jwt, using code that looks something like this:
constexpress=require('express');constjwt=require('express-jwt');constpassport=require('passport');constpassportJwt=require('passport-jwt');constrTracer=require('cls-rtracer')passport.use('jwt',newpassportJwt.Strategy(/* jwt options */));constapp=express();app.use(passport.initialize());app.use(rTracer.expressMiddleware());app.use((req,res,next)=>{console.log(rTracer.id());// prints an id});app.get('/foo',passport.authenticate('jwt',{session: false}),(req,res)=>{console.log(rTracer.id());// prints 'undefined' });app.get('/bar',(req,res)=>{console.log(rTracer.id());// prints an id });
I assume this is fundamentally an issue with either passport or passport-jwt, and so it's not fixable on your end. Your readme said to submit an issue, though, so I hope this is helpful.
The text was updated successfully, but these errors were encountered:
Indeed it looks like a potential async hooks context loss in express-jwt/passport-jwt/node-jsonwebtoken. Thanks for reporting this. If there will be more cls-rtracer users who suffer from this issue, I'll try to investigate the problem.
When passport.js is used with
session:false
the async context is lost andrTracer.id()
stops returning an ID. I'm pretty sure this a similar issue as described in the README and #20. That said, it seems to be something slightly different, given that #20 is an issue withexpress-session
and I've explicitly disabled sessions here.Specifically I'm using passport.js configured to accept JWTs with
passport-jwt
, using code that looks something like this:I assume this is fundamentally an issue with either passport or passport-jwt, and so it's not fixable on your end. Your readme said to submit an issue, though, so I hope this is helpful.
The text was updated successfully, but these errors were encountered: