AWS Lambda getting “Cannot find module lambda” due to missing index.mjs

I am trying to deploy my lambda function via Serverless framework’s sls deploy command. The deployment goes smoothly but when the lambda runs I get the following error.

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'lambda'nRequire stack:n- /var/runtime/index.mjs",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'lambda'",
        "Require stack:",
        "- /var/runtime/index.mjs",
        "    at _loadUserApp (file:///var/runtime/index.mjs:1087:17)",
        "    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)",
        "    at async start (file:///var/runtime/index.mjs:1282:23)",
        "    at async file:///var/runtime/index.mjs:1288:1"
    ]
}

I do not have any index.mjs file in my src or build folder so I am not sure what the next steps are to fix this. I went through few similarly asked questions here and other places but none of those solutions actually worked for me.

My project folder structure

enter image description here

My Serverless.yml file

service: api-gateway-websocket-poc
frameworkVersion: '3'

provider:
  name: aws
  runtime: nodejs18.x
  stage: ${opt:stage, 'dev'}
  region: ${opt:region, 'us-east-2'}
  websocketsApiName: api-gateway-ws-poc-${self:provider.stage}
  websocketsApiRouteSelectionExpression: $request.body.action
  websocketsDescription: API Gateway WS POC
  iamRoleStatements:
    - Effect: Allow
      Action:
        - "execute-api:ManageConnections"
      Resource:
        - "arn:aws:execute-api:*:*:**/@connections/*"

functions:
  connectionHandler:
    handler: src/lambda.handler
    events:
      - websocket:
          route: $connect
      - websocket:
          route: $disconnect
  defaultHandler:
    handler: src/lambda.handler
    events:
      - websocket:
          route: $default
  actionHandler:
    handler: src/lambda.handler
    events:
      - websocket:
          route: myAction

My lambda.ts file

import * as AWS from 'aws-sdk';
import { APIGatewayProxyHandler, APIGatewayProxyResult } from "aws-lambda";
  
export const handler: APIGatewayProxyHandler = async (
  event,
  context,
  callback
): Promise<APIGatewayProxyResult> => {
  
  console.log("on send message", event.requestContext.connectionId, event.requestContext.routeKey, event.body);

  const {
    routeKey,
    connectionId,
    domainName,
    stage
  } = event.requestContext;

  
  return { statusCode: 200, body: 'Data sent.' };
};

My tsconfig.json

{
  "compilerOptions": {
    "composite": true,                                /* Enable constraints that allow a TypeScript project to be used with project references. */
    "target": "es2016",                                  /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    "module": "commonjs",                                /* Specify what module code is generated. */
    "rootDir": "./src",                                  /* Specify the root folder within your source files. */
    "allowJs": true,                                  /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
    "outDir": "./build",                                   /* Specify an output folder for all emitted files. */
    "esModuleInterop": true,                             /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
    "forceConsistentCasingInFileNames": true,            /* Ensure that casing is correct in imports. */
    "strict": true,                                      /* Enable all strict type-checking options. */
    "skipLibCheck": true                                 /* Skip type checking all .d.ts files. */
  }
}

Package.json

{
  "name": "api-gateway-websocket-poc",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "nodemon src/app.ts",
    "start": "tsc && node build/app",
    "build": "npm run clearBuild && npm run tsc",
    "clearBuild": "npm run rimraf -- build",
    "rimraf": "rimraf",
    "tsc": "tsc"
  },
  "dependencies": {
    "express": "^4.18.2",
    "serverless-http": "^3.1.1"
  },
  "devDependencies": {
    "@types/aws-lambda": "^8.10.137",
    "@types/express": "^4.17.21",
    "@types/node": "^20.12.11",
    "aws-sdk": "^2.1617.0",
    "nodemon": "^3.1.0",
    "rimraf": "^5.0.5",
    "serverless": "^3.38.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.4.5"
  }
}

I am deploying this from my local machine by simple doing
SLS_DEBUG=* serverless deploy --stage dev --region us-east-2

I am trying to understand from where the index.mjs file is suppose to come from, or whether I need to change my own pattern before deploying to AWS.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật