Lambda fails: Runtime ImportModuleError on Winston logger service

Hi,

I have deployed a Nest app AWS Lambda successfully. Then i added Winston to log as a Json. After this, i’ve got the following error:

    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module './json.js'\nRequire stack:\n- /var/task/_optimize/**my-nest-app**/src/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module './json.js'",
        "Require stack:",
        "- /var/task/_optimize/**my-nest-app**/src/index.js",
        "- /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.<anonymous> (/var/runtime/index.js:43:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:1138:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)",
        "    at Module.load (internal/modules/cjs/loader.js:986:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:879:14)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)",
        "    at internal/main/run_main_module.js:17:47"
    ]
}

Any idea ?

Thanks for your help.

1 Like