CoorpAcademy / serverless-plugins

Collection of serverless plugins :zap:
231 stars 132 forks source link

serverless offline startup fails due to serverless-offline-kinesis build error #250

Open gabsong opened 1 year ago

gabsong commented 1 year ago

Describe the bug Cannot find module error. The file https://github.com/CoorpAcademy/serverless-plugins/blob/d25c3103a9ffe94248adfe36f10b21ca979d471b/packages/serverless-offline-kinesis/src/index.js has a combination of common JS and ESM, and this causes build errors on repositories using the serverless-offline-kinesis package.

The repo in which this issue happens has a package.json like the following. Note that there is no "type" property:

{
  "name": "network-api",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "author": "",
  "license": "ISC",
  "scripts": {
    "build": tsc,
    "dev": "npx sls offline start  --noPrependStageInUrl"
  },
  "dependencies": {
  }
  "devDependencies": {
    "aws-sdk": "^2.1046.0",
    "serverless": "^3.22.0",
    "serverless-offline": "^8.8.1",
    "serverless-offline-kinesis": "^6.2.3",
    "serverless-plugin-typescript": "^2.1.2",
    "typescript": "^4.9.4"
  }
}

To Reproduce

The project should make use of the serverless-offline-kinesis plugin and serverless-offline.

  1. Invoke the lambda function with serverless offline.
  2. The build will fail and show something like this image