Closed hemanth1226 closed 3 years ago
@jeremydaly - Can you take a look at this? Same issue happens when trying to use https://nodejs.org/api/async_hooks.html too. Trying to persist custom variables per request in continuous-local-storage and use them as needed in logging, error handling, etc. I have used log-serializers
, but there are use cases beyond that where cls-hooked
or async-hooks
have been very useful
This is resolved by using the cls-hooked:runPromise
option
clsNamespace.runPromise(() => {
clsNamespace.set("x-amzn-trace-id", "test id");
// console.log(clsNamespace, "inside run");
return Promise.resolve(next());
});
Thanks Muthu. This worked.
Hi, I am trying to replace my existing express application with
lambda-api
and trying to see if i can achieve all the existing functionalities. I liked it so far but facing some challenges and i am looking for some help.I am trying to use "https://www.npmjs.com/package/cls-hooked" in my project to store request and response data and log them. But i am facing issues integrating it. Do you have any option to store the data and retrieve them in controllers or services and log the data?
Attached zip file and some of the code that i tried. Any help is appreciated. cls-hooked-lambda-api.zip