aws / aws/aws-xray-sdk-node

Support undici

Open
#622 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
280
Forks
157
PR merge metrics
No merged PRs in 30d

Description

[Undici](https://github.com/nodejs/undici) is the new official node http client.
When trying xray on a Node-18-Lambda while using undici I get an error.

There is an issue on undicis side (https://github.com/nodejs/undici/issues/2190) about not working with xray.
They refer to use the diagnostics channel.

```
import {captureHTTPsGlobal} from 'aws-xray-sdk';
import * as http from 'http';
import * as https from 'https';

captureHTTPsGlobal(http);
captureHTTPsGlobal(https);
```
```
2023-10-22T11:24:52.170Z undefined ERROR Uncaught Exception {
"errorType": "TypeError",
"errorMessage": "Cannot add property __request, object is not extensible",
"stack": [
"TypeError: Cannot add property __request, object is not extensible",
" at enableCapture (file:///var/task/index.mjs:34012:25)",
" at captureHTTPsGlobal3 (file:///var/task/index.mjs:33900:9)",
" at file:///var/task/index.mjs:35587:44",
" at ModuleJob.run (node:internal/modules/esm/module_job:194:25)"
]
}

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Node 18 Lambda failure with undici and the shown captureHTTPsGlobal setup. Read the linked undici diagnostics-channel issue and the SDK's HTTP capture entry point; done means undici requests work with X-Ray without the reported non-extensible-object error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, observability-sre
Issue type
Feature
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.