Aws-xray-sdk-node: Cannot find module 'aws-xray-sdk-core/lib/middleware/sampling/service_connector' from 'node_modules/aws-xray-sdk-express/lib/express_mw.js'

Created on 13 May 2021  路  8Comments  路  Source: aws/aws-xray-sdk-node

Cannot find module 'aws-xray-sdk-core/lib/middleware/sampling/service_connector' from 'node_modules/aws-xray-sdk-express/lib/express_mw.js'

Version 3.3.2 introduces this bug due to 84e65c3f2c9119a40f88c5e6ea1d9070a0a8ca7f

The absolute path is missing the /dist/ for consumers

bug

All 8 comments

My team also had an issue derived from the new /dist/ path behind the /lib/ because I directed accessed to aws-xray-sdk-core/lib/context_utils on my project. so I got Cannot find module error. I temporarily solved this issue by fixing aws-xray-sdk-core version to downgraded one("aws-xray-sdk-core": "^3.1.0" -> "aws-xray-sdk-core": "3.3.1" on package.json).

We have the same problem with error Runtime.ImportModuleError: Error: Cannot find module 'aws-xray-sdk-core/lib/middleware/sampling/service_connector' - version 3.2.0 all packages aws-xray-sdk-*

Hello,

Thanks for raising this issue. We'll get a patch out ASAP to address it.

@ChungminPark we intend on keeping the new structure with dist in the path. All of the public APIs in the context_utils module are exposed via the top-level AWSXRay object, e.g. AWSXRay.setSegment(), and I would recommend referencing them like that so you aren't dependent on the directory structure.

The reference that caused this crash should not have been an absolute path to begin with - that was a mistake in the original change linked in this issue.

Can we get a npm publish please? (nevermind I see one in-progress now)

@GregTurner preparing the release right now.

This issue is fixed in v3.3.3, available now on NPM. Please let us know if there are any further issues. Apologies again for the trouble.

@willarmiros Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Enase picture Enase  路  5Comments

ivanmartos picture ivanmartos  路  4Comments

agustinhaller picture agustinhaller  路  7Comments

chearmstrong picture chearmstrong  路  6Comments

chearmstrong picture chearmstrong  路  5Comments