aws / aws/aws-xray-sdk-node

Don't crash if segment cannot be resolved in `captureAsyncFunc`

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
280
Forks
157
PR merge metrics
No merged PRs in 30d

Description

In the case `captureAsyncFunc` is given an invalid segment (which can be supported with some error logs in other capture solutions) the execution function is called without any support for `subsegment.close()`.
I might make sense to pass a dummy object with a close function to not crash the client code, and thus avoiding to systematically call `subsegment && subsegment.close()`

Contributor guide

Open the contributing guide

Research direction

Start by locating the captureAsyncFunc entry point and trace how it handles an invalid segment before calling the execution function. Confirm the behavior with the repository's existing test setup. Done means client code can safely call subsegment.close() without crashing when the segment cannot be resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.