Replies: 7 comments
-
@subzero10 any thoughts on this one? |
Beta Was this translation helpful? Give feedback.
-
Yeah, we could improve the type definition, it is quite basic at the moment.
Indeed, the callback vs promise adds additional complexities to the code. It’s harder to read and maintain. We even had to come up with some hacks to support this. I would say the evolution of this code would be to either deprecate the callback version entirely or split in two
Domains have been deprecated for a long time and personally I have never used them in my projects. +1 to go for an alternative solution.
Yes, that would be nice! Going forward, I suggest we create a few tickets out of this, since they can be tackled in parallel (or independently).
What do you think? |
Beta Was this translation helpful? Give feedback.
-
I'm forgetting exactly why we used domains before, but there was a really good reason (and I believe even though they're deprecated, they're still used by some similar packages). I'd want to research to make sure we're not losing anything/adding regressions by removing/replacing them. I'm good with the other items. Regarding promises vs. callbacks, I'm fine with promises internally. For end users, I just want to make sure that we support whatever it is they're doing with minimal hassle (two functions would be OK). Does @subzero10's suggestions cover your initial thoughts, @shalvah? Feel free to create some additional issues so that we can continue these discussions separately (if it makes sense). We could also try using GitHub Discussions to further discuss these items before creating discrete issues. I think I'd like to try adding GitHub Discussions to our workflow in the future, to cut down on issues. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I'm on board. Re the typedef, maybe we can add this lambda types package, (example post for reference) although that means every user of HB JS will have that included.
I'd prefer this, but it seems the callback version is still supported, though I rarely see it in newer code. Still, our current implementation does two things we need to fix:
Re domains, we could look around, but I believe their main use case was to track context in concurrent async code executed in the same process, but Lambda functions are one process per request, and I think @joshuap I can convert this to a discussion if you think it's a better fit. |
Beta Was this translation helpful? Give feedback.
-
@shalvah thanks, yeah let's try converting to a discussion! |
Beta Was this translation helpful? Give feedback.
-
Ah, now that I think about it, I think domains were used not for error handling, but to store context local to a handler function and its async calls. They're used other places in the codebase, like this. I think it is worth replacing with the current recommendation, AsyncLocalStorage, but that was only introduced in Node.js v13.10.0, v12.17.0, so that might limit our options. This complicates things.🤔 |
Beta Was this translation helpful? Give feedback.
-
Hey all, As discussed, I created the following tickets:
I did not create a ticket about deprecating domains, since it's still under discussion/research. |
Beta Was this translation helpful? Give feedback.
-
I'm using honeybadger-js on an AWS Lambda function. It works (wrapping my handler in
Honeybadger.lambdaHandler()
catches errors), but I'm noticing a few things:callback
parameter, when you can just return aPromise
these days.async_hooks
, but I think we may not even need any of those—unhandledRejection
anduncaughtException
, or even a try/catch should be enough. (Also, Node.js 10 is no longer supported, so no need to worry about that.)I'm willing to explore/implement these myself, just documenting them here for any thoughts.
Beta Was this translation helpful? Give feedback.
All reactions