-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError "aws_xray_sdk_mysql_1.captureMySQL is not a function" #450
Comments
I wasn't able to reproduce this with a normal TypeScript app importing |
Can confirm that we are getting the same issue:
|
Apologies, we have not been able to prioritize this investigation yet. @beanaroo were you able to apply the workaround suggested in the initial post? |
Hi @willarmiros, we're encountering the same issue when importing 'aws-xray-sdk-postgres'. The proposed workaround in the initial post worked for us. For context, we are not using webpack. We stumbled upon the issue while replacing the 'aws-xray-sdk' package with 'aws-xray-sdk-core' + 'aws-xray-sdk-postgres' |
Hi @Irvel thanks for reporting as well. We've documented this issue and will investigate a fix when we have bandwidth. For what it's worth here is where we define the
I wasn't able to reproduce initially so this will require a longer look. As a side note, the AWS Distro for OpenTelemetry JavaScript has support for instrumenting MySQL and Postgres functions and is written in native TypeScript for much more robust typings. It also has first-class support for tracing with X-Ray, so feel free to check that out. |
I have the same issue with export default function captureMySQL(mysql: typeof MySQL): captureMySQL.PatchedMySQL; instead of the current:
Same fix should apply to the postgres version. Until this is fixed, you can use this as a workaround: import originalCapturePostgres from 'aws-xray-sdk-postgres';
import originalPg from 'pg';
// Workaround for busted typings
// @ts-ignore
const capturePostgres: typeof originalCapturePostgres.capturePostgres = originalCapturePostgres;
export const pg = capturePostgres(originalPg); |
We've recently updated
aws-xray-sdk-mysql
from version3.2.0
to3.3.3
, but experienced issues with our Typescript projects.Due to the changed Typescript definitions, we had to adjust the import from
to
However, this resulted in errors as such:
Workaround
As a temporary workaround, replace
With
The text was updated successfully, but these errors were encountered: