TypeError "aws_xray_sdk_mysql_1.captureMySQL is not a function"
- Dominant language
- JavaScript
- Stars
- 280
- Forks
- 157
- PR merge metrics
- No merged PRs in 30d
Description
We've recently updated `aws-xray-sdk-mysql` from version `3.2.0` to `3.3.3`, but experienced issues with our Typescript projects.
Due to the changed Typescript definitions, we had to adjust the import from
```typescript
import captureMySQL from 'aws-xray-sdk-mysql';
```
to
```typescript
import {captureMySQL} from 'aws-xray-sdk-mysql';
```
However, this resulted in errors as such:
```log
{
"errorType": "TypeError",
"errorMessage": "aws_xray_sdk_mysql_1.captureMySQL is not a function",
"stack": [
"TypeError: aws_xray_sdk_mysql_1.captureMySQL is not a function",
" at Object.exports.setup (/var/task/src/api.js:2:1851104)",
" at Object. (/var/task/src/api.js:2:1848725)",
" at __webpack_require__ (/var/task/src/api.js:2:295)",
" at Object. (/var/task/src/api.js:2:1847607)",
" at __webpack_require__ (/var/task/src/api.js:2:295)",
" at /var/task/src/api.js:2:1594",
" at Object. (/var/task/src/api.js:2:1641)",
" at Module._compile (internal/modules/cjs/loader.js:999:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
" at Module.load (internal/modules/cjs/loader.js:863:32)"
]
}
```
**Workaround**
As a temporary workaround, replace
```typescript
import {captureMySQL} from 'aws-xray-sdk-mysql';
```
With
```typescript
// eslint-disable-next-line @typescript-eslint/no-var-requires
const captureMySQL = require('aws-xray-sdk-mysql');
```
Contributor guide
Assessment
This issue has not been assessed yet.