Closed remcoabalain closed 3 years ago
Full error:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'knex'\nRequire stack:\n- /var/task/functions/organization.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module 'knex'",
"Require stack:",
"- /var/task/functions/organization.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:1068:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)",
" at Module.load (internal/modules/cjs/loader.js:933:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:774:14)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)",
" at internal/main/run_main_module.js:17:47"
]
}
Never mind! We've found it. We needed to add knex-aurora-data-api-client to the forceInclude/external config as well 😅 . Since that package requires knex as well, we shoudn't let webpack build it inside the package.
custom:
bundle:
disableForkTsChecker: true
forceInclude:
- mysql
- knex-aurora-data-api-client
externals:
- knex-aurora-data-api-client
Hi, we've implemented knex with knex-aurora-data-api-client. I noticed in the docs that the module knex is excluded from the bundle, but I didn't see how knex would be available at the server on runtime. And indeed this looks like to be a problem on runtime, our functions fail because of the module "knex" cannot be found. I've been searching all day, but can't find a solution. I noticed some other Knex related issues, but none of them fixes our problem. The project is build via seed.run. Any ideas to solve our problem? Thanks in advance 😄
Environment:
Dependencies