Lambda fails after deployment: Runtime.ImportModuleError "errorMessage":"Error: Cannot find module s-<function>`

After successfully deploying my stack using serverless deploy, my lambda functions fail, citing a module import error Runtime.ImportModuleError.

Because I need binaries built specifically for linux, the packaging and deployment takes place inside a docker container, the docker file is as follows:

FROM lambci/lambda:build-nodejs10.x

ENV AWS_DEFAULT_REGION XXXX

ENV SERVERLESS_ACCESS_KEY XXXXXXXXXXXXXXXX

ENV AWS_ACCESS_KEY_ID XXXXXXXXXXXX
ENV AWS_SECRET_ACCESS_KEY XXXXXXXXXXXXXXX

RUN npm install -g serverless

WORKDIR /usr/src/app

COPY . .

RUN rm -rf node_modules

RUN npm install

CMD serverless deploy
The lambda’s stack trace is as follows:

{
  "errorType": "Runtime.ImportModuleError",
  "errorMessage": "Error: Cannot find module 's-fetchUserData'",
  "trace": [
    "Runtime.ImportModuleError: Error: Cannot find module 's-fetchUserData'",
    "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
    "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
    "    at Object.<anonymous> (/var/runtime/index.js:36:30)",
    "    at Module._compile (internal/modules/cjs/loader.js:776:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)",
    "    at Module.load (internal/modules/cjs/loader.js:653:32)",
    "    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
    "    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)",
    "    at startup (internal/bootstrap/node.js:283:19)"
  ]
}

If I download the .zip file from s3 for the deployment, I can see the s_fetchUserData.js file in the root of the project.

Here’s the file tree:

.
├── Dockerfile
├── NOTES.md
├── README.md
├── docker-compose.yml
├── package-lock.json
├── package.json
├── s_fetchUserData.js
├── s_generateEmail.js
├── s_processGif.js
├── s_processPhoto.js
├── s_processTimelapseVideo.js
├── s_startExecution.js
├── serverless_sdk
│ └── index.js
└── src
├── handlers
│ ├── email
│ │ ├── handler.js
│ │ └── mira.code-workspace
│ ├── image-processing
│ │ ├── gif
│ │ │ └── handler.js
│ │ └── photo
│ │ └── handler.js
│ ├── start
│ │ └── handler.js
│ ├── test
│ │ └── handler.js
│ ├── timelapse
│ │ └── handler.js
│ ├── upload
│ │ └── handler.js
│ ├── user
│ │ └── handler.js
│ └── video
│ └── timelapse
│ └── handler.js
├── templates
│ └── email
│ └── content.pug
├── test
│ ├── email.json
│ ├── index.html
│ ├── locationData.json
│ ├── processImage.json
│ ├── pugRenderer.js
│ ├── timelapse.json
│ ├── timelapseVideo.json
│ ├── user.json
│ └── views
│ ├── email-bg.svg
│ └── index.pug
└── utils
└── index.js

19 directories, 35 files

Only just started with this stuff myself but in the error message it’s ‘s-fetchUserData’ and in the tree ‘s_fetchUserData.js’ so maybe the -_ needs correcting somewhere?