serverless-plugin-optimize
serverless-plugin-optimize copied to clipboard
Runtime.ImportModuleError missing module ./combine.js
works fine without plugin (see serverless.yml and package.json below)
get runtime error trying to execute lambda
{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module './combine.js'\nRequire stack:\n- /var/task/_optimize/promo-warm-lead-local-click/src/functions/handler.js
serverless --version Framework Core: 2.25.2 Plugin: 4.4.3 SDK: 2.3.2 Components: 3.7.0
package.json package.txt serverless.yml serverless.txt
@tim-oe any updates on this, it's something related to the bundling of the Winston plugin, but don't know what exactly issue is
I am facing the same issue
I think the problem is here, I'm not 100% sure:
/*
* @api private
* method {function} exposeFormat
* Exposes a sub-format on the main format object
* as a lazy-loaded getter.
*/
function exposeFormat(name, path) {
path = path || name;
Object.defineProperty(format, name, {
get() {
return require(`./${path}.js`);
},
configurable: true
});
}
//
// Setup all transports as lazy-loaded getters.
//
exposeFormat('align');
exposeFormat('errors');
exposeFormat('cli');
exposeFormat('combine');
maybe you can add winston
to your external:
optimize:
external: ['winston']