aws / aws-xray-sdk-node

The official AWS X-Ray SDK for Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

yschondorf opened this issue · comments

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?