aws-lambda-typescript icon indicating copy to clipboard operation
aws-lambda-typescript copied to clipboard

Cannot find module

Open rgstephens opened this issue 7 years ago • 1 comments

When I try to import modules, I get this error. I have confirmed that the package.json has the required modules and there is a node_modules directory with the required module. Any suggestions on what else I should be looking for?

I've never used webpack before (just gulp-typescript).

I've installed arangojs but I'm still getting a runtime error:

Cannot find module 'arangojs'

rgstephens avatar Nov 05 '18 23:11 rgstephens

Since I first posted this, I've been able to run without the module error in the local test, lambda:run, express server. I've also created a new sample project that demonstrates the issue. It must have something to do with the type of module or it's typescript declaration for arangojs. I've also duplicated this problem with the axios library.

import { Handler } from 'aws-lambda';
import { Database } from 'arangojs';

const func: Handler = async (event, context) => {
   const db = new Database(event.arangoDB.serverName);
   console.log('db:', db);
   return event;
};

export default func;

rgstephens avatar Nov 09 '18 19:11 rgstephens