-
Notifications
You must be signed in to change notification settings - Fork 24
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
I am unable to find the ctx arguments here where in I am trying to bind the context from my end #5
Comments
I am unable to find the ctx arguments here where in I am trying to bind the context from my end: app.use(function* (next) { |
Could you describe what you're trying to achieve with this wrapper generator function? A sample script would also help. |
@kirankdeveloper could you also provide a stack trace? |
@keenondrums my library only accept the generator function so i have to use this way now somehow i am able to pass context to koaMiddleware function. This is my code now. let koaMiddleWare = rTracer.koaMiddleware({ However now my next issue is i want to access request id in another file call log.js which doesn't have access to request object. I am reading like this const requestId = rTracer.id(); but requestd is undefined here.. I think cls context losing somewhere because of that i am not able to get it. could you please guide me more about this. |
@kirankdeveloper if you're using Koa, then app.use(rTracer.koaMiddleware({
useHeader: true,
headerName: 'test-header'
}) You can also check this sample for a more complete example. |
@puzpuzpuz I am using the older version of koa and for me if I try that way it is giving me an error that it expects generator function. rtracer.koaMiddleware returns a Promise so I am trying as following app.use(function* (next) { This also seems to be working fine however I am unable to receive const rid = rTracer.id() on integration with my loggers |
@puzpuzpuz Looks like this library is not supported for an older version of Koa, Is there any hack which I can try to make this library work on older Koa (1.1.2)? |
@kirankdeveloper I see. Which version of Koa are you using? @rishikapadia1 At the moment only Koa v2 is supported. But if there is a demand for Koa v1 support, I can implement it. Going to create a separate issue for this enhancement. |
@puzpuzpuz We (I and @kirankdeveloper) upgraded koa library and this is working great, you can close or resolve this issue. Thanks for your quick response. |
@kirankdeveloper @rishikapadia1 glad that you found a workaround. In any case, there is already the |
@puzpuzpuz Thank you for quickly responding on this. Nicely done! |
cls-rtracer/index.js
Line 59 in 19e7e8b
The text was updated successfully, but these errors were encountered: