serverless-plugin-optimize icon indicating copy to clipboard operation
serverless-plugin-optimize copied to clipboard

Runtime.ImportModuleError missing module ./combine.js

Open tim-oe opened this issue 3 years ago • 3 comments

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 avatar Jun 01 '21 15:06 tim-oe

@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

anees-kodappana avatar Aug 25 '21 11:08 anees-kodappana

I am facing the same issue

shesupplypi avatar Sep 02 '21 03:09 shesupplypi

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']

juliankha avatar Oct 26 '21 11:10 juliankha