Hi,
I am a newbie to serverless framework. I am stuck in deployment stage, it would be great if someone could help me.
I have all my handler functions in a private github repo as a npm package. Now in an other repository, i have installed my private package and defined path to my handler functions as node_modules/@myOrg/handlerRepo/src/handlers/index.getItem
. This seems to work locally with serverless-offline
but when deployed to aws using serverless deploy
command, I see that it is installing and minifying my packages, but when I test my lambda, I am getting the following error:
{
“errorType”: “Runtime.ImportModuleError”,
“errorMessage”: “Error: Cannot find module ‘index’\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js”,
“trace”: [
“Runtime.ImportModuleError: Error: Cannot find module ‘index’”,
“Require stack:”,
“- /var/runtime/UserFunction.js”,
“- /var/runtime/index.js”,
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object. (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:999:30)",
" at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)",
" at Module.load (internal/modules/cjs/loader.js:863:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
" at internal/main/run_main_module.js:17:47"
]
}
also I dont understand, why my private dependency @myOrg/handlerRepo
is not in the final package.json.
Any help is appreciated.
Thanks