I am using the aws-nodejs-typescript template. Everything works fine but when I try to import aws-sdk I get 3 Module not found errors.
import { failure, success } from '../../../libs/response';
import { APIGatewayProxyHandler } from 'aws-lambda';
import { DynamoDB } from 'aws-sdk';
const dynamoDb = new DynamoDB.DocumentClient();
export const handler: APIGatewayProxyHandler = async () => {
try {
const params = {
TableName: 'My_Table',
Key: {
pk: 'variable',
sk: 'variable'
}
};
const result = await dynamoDb.query(params).promise();
return success(result);
} catch (e) {
return failure();
}
};
ERROR in ...../node_modules/aws-sdk/lib/aws.js
Module not found: Error: Can't resolve '../clients/all' in '.....\node_modules\aws-sdk\lib'
@ ...../node_modules/aws-sdk/lib/aws.js 6:0-25
@ ./functions/get-pending-validation-products.ts
ERROR in .....//node_modules/aws-sdk/lib/aws.js
Module not found: Error: Can't resolve './core' in '.....\node_modules\aws-sdk\lib'
@ C:/Monkey Minds/Repositories/3dNinjas/3d-ninjas-ext-api/node_modules/aws-sdk/lib/aws.js 3:10-27
@ ./functions/get-pending-validation-products.ts
ERROR in ...../node_modules/aws-sdk/lib/aws.js
Module not found: Error: Can't resolve './node_loader' in '.....\node_modules\aws-sdk\lib'
@ ...../node_modules/aws-sdk/lib/aws.js 1:0-24
@ ./functions/get-pending-validation-products.ts
Are types missing? Types are already included in aws-sdk so I don’t need to install @types/aws-sdk.
When I browse my node_modules folder everything is there including types.