aws-sam-webpack-plugin icon indicating copy to clipboard operation
aws-sam-webpack-plugin copied to clipboard

Can't load custom layers (Module not found)

Open 50l3r opened this issue 5 years ago • 0 comments

I recieved an error when i try to require my custom layers:

`ERROR in ./src/maras/reviews.ts Module not found: Error: Can't resolve '/opt/nodejs/utils' in 'D:\Git\gestios\gestios-lambda\src\maras' @ ./src/maras/reviews.ts 13:14-42

ERROR in ./src/maras/reviews.ts Module not found: Error: Can't resolve 'gestios-sdk-js' in 'D:\Git\gestios\gestios-lambda\src\maras' @ ./src/maras/reviews.ts 12:16-41

ERROR in D:\Git\gestios\gestios-lambda\src\maras\reviews.ts ./src/maras/reviews.ts [tsl] ERROR in D:\Git\gestios\gestios-lambda\src\maras\reviews.ts(1,17) TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node.

ERROR in D:\Git\gestios\gestios-lambda\src\maras\reviews.ts ./src/maras/reviews.ts [tsl] ERROR in D:\Git\gestios\gestios-lambda\src\maras\reviews.ts(2,15) TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node.`

Thats the code:

const GestiOS = require('gestios-sdk-js');
const utils = require('/opt/nodejs/utils');

let response;

export interface Event {
	name: string;
}

export default async (event: Event): Promise<string> => (
	`Hello ${event.name}`
);

50l3r avatar Jun 22 '20 11:06 50l3r