aws / aws/aws-xray-sdk-node

captureHTTPsGlobal now results in `TypeError: Cannot redefine property: request`

Open
#487 13 comments 12 reactions 1 assignee Claimed by @willarmiros View on GitHub
bug
Dominant language
JavaScript
Stars
280
Forks
157
PR merge metrics
No merged PRs in 30d

Description

When packaging and running my AWS Lambda function using serverless + webpack with new versions of aws-sdk and aws-xray-sdk-core, I receive this error: `TypeError: Cannot redefine property: request`

```
import * as AWS from 'aws-sdk';
// import * as http from 'http';
import * as https from 'https';
import { ObjectType, PermissionRole, PrivacyRating } from './gql-types';
import axios from 'axios';
import { decrypt } from './utils/kms.service';

captureAWS(AWS);
// captureHTTPsGlobal(http, true) ; <-- having this uncommented causes the issue
// captureHTTPsGlobal(https, true); <-- having this uncommented causes the issue

AWS.config.update({
httpOptions: {
agent: new https.Agent({
keepAlive: true,
maxSockets: Infinity,
}),
},
});
```

Package versions:
```
"node": "14",
"aws-xray-sdk-core": "3.3.4",
"aws-sdk": "2.1074.0"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.