aws / aws/aws-xray-sdk-node

captureHTTPsGlobal intercepting RAPIDClient.postInitError

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

Description

I'm getting the following error in one of my lambdas:

```
ERROR Error: Missing AWS Lambda trace data for X-Ray. Ensure Active Tracing is enabled and no subsegments are created outside the function handler.
at Object.contextMissingLogError [as contextMissing] (/var/task/lambda.js:40055:27)
at Segment.resolveLambdaTraceData (/var/task/lambda.js:40428:49)
at Object.getSegment (/var/task/lambda.js:40125:25)
at Object.resolveSegment (/var/task/lambda.js:40104:25)
at captureOutgoingHTTPs (/var/task/lambda.js:42220:37)
at Object.captureHTTPsRequest [as request] (/var/task/lambda.js:42309:16)
at RAPIDClient._post (file:///var/runtime/index.mjs:510:33)
at RAPIDClient.postInitError (file:///var/runtime/index.mjs:460:14)
at Object.uncaughtException (file:///var/runtime/index.mjs:1177:14)
at process. (file:///var/runtime/index.mjs:1185:20)
```

It appears that there's an uncaught exception somewhere in my init code. The lambda runtime is attempting to report the error to some http endpoint. However, the xray instrumentation is preventing that from working.

I know I can set `AWS_XRAY_CONTEXT_MISSING`, but I feel like the xray sdk should work with the runtime without any additional workarounds.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported uncaught init exception with X-Ray HTTP capture enabled, then trace how captureHTTPsGlobal handles RAPIDClient.postInitError in the Lambda runtime stack shown. Done means the runtime can report the initialization error without X-Ray instrumentation causing the missing-trace-data failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
backend, cloud, observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.