Hey guys! I create a file with some authentication functions to run at Api Gateway Locally I can invoke the functions point to my redis local and all works fine, when I run it on productions I get this stack on Cloud Watch:
Unable to import module 'handler': Error
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/task/handler.js:2:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
My serverless.yml
service: gandalf
provider:
name: aws
runtime: nodejs8.10
stage: production
memorySize: 256
functions:
createSession:
handler: handler.create
events:
- http:
path: /session
method: post
removeSession:
handler: handler.remove
events:
- http:
path: /session
method: delete
verifySession:
handler: handler.verify
events:
- http:
path: /session
method: get
refreshSession:
handler: handler.refresh
events:
- http:
path: /session
method: put
All dependencies that I used was in my package.json
"dependencies": {
"jsonwebtoken": "^8.3.0",
"redis": "^2.8.0",
"serverless": "^1.30.1"
}