fix(node): prevent node crash on uncaught exception #1001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧰 Changes
When fire-and-forget is set, the request promise isn't returned to the log handler, meaning the catch here doesn't prevent node from exiting on a request failure.
We also got caught with a trio of bugs:
development
is set totrue
another floating promise rejects and crashes the process ("fixed" by fix(node): avoid rethrowing errors when development=true #1003 but likely requires follow-up)Apologies on the order of discovery here, was debugging with my eyes rather than a debugger.
Fixing issue 2 (development rethrows) is probably not something I can contribute outside of just removing the re-throw behavior. Not sure how you want to handle error handling within your SDK (logging, letting the caller supply a handler, etc.).
🧬 QA & Testing
Send a large load of traffic at a node service, watch it crash. To be honest, haven't tested this patch yet, working on confirming this fixes it, but I'm like 99% sure this does the trick.