I've created two lambda functions with similar settings a couple days apart. One was able to const qs = require('qs');. The second function was created a couple days later. However it gave the following error when it tried to require qs.
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'qs'\nRequire stack:\n- /var/task/handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module 'qs'",
"Require stack:",
"- /var/task/handler.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:956:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)",
" at Module.load (internal/modules/cjs/loader.js:812:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:724:14)",
" at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)",
" at internal/main/run_main_module.js:17:11"
]
}
Both functions runtime are set to Node.js 12.x. Are lambda environment suppose to be inconsistent like this? Should I just install qs on all my function deployment to make them consistent and avoid errors in the future?