aws / aws/aws-xray-sdk-node

Cannot find module 'aws-xray-sdk' in nodejs Lambda

Open
#617 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
280
Forks
157
PR merge metrics
No merged PRs in 30d

Description

I am trying to use aws-xray-sdk.
package.json has these dependencies:

"dependencies": {
"aws-sdk": "^2.1357.0",
"aws-xray-sdk": "^3.3.0"
}

Lambda function has this code:

const AWSXRay = require('aws-xray-sdk');
const AWS = AWSXRay.captureAWS(require('aws-sdk'));

I installed aws-xray-sdk using "npm install aws-xray-sdk --save" and it is installed successfully.

However, when I invoke my Lambda function I get:
"Error: Cannot find module 'aws-xray-sdk'\nRequire stack:\n- /var/task/authentication.js\n- /var/runtime/index.mjs",

Any ideas?

Contributor guide

Open the contributing guide

Research direction

Start with package.json and the Lambda deployment containing authentication.js, checking whether the installed aws-xray-sdk dependency is present in the artifact that runs in Lambda. Done means the deployed function can resolve require('aws-xray-sdk') and invoke without the reported module-not-found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.