Hello
I’m trying to create a lambda function within aws using serverless.
My project structure:
serverless/function/books/add-book.ts
const addBookFunction = {
handler: "src/controllers/books-controller.postBookFunction",
events: [
{
http: {
method: "get",
path: "test",
private: true,
},
},
],
};
export default addBookFunction;
src/controllers/books-controller.ts
import { postBook } from "../use-cases/books";
module.exports.postBookFunction = async (event, context) => postBook(event, context);
Withing cloudwatch I’m getting the following error:
"errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module 'books-controller'\nRequire stack:\n-var/runtime/index.mjs"
What am i doing wrong to get the handler path correct?