goldwasserexchange/serverless-plugin-webpack

Getting "TypeError: Path must be a string. Received undefined"

dpandya opened this issue · 2 comments

Getting following error after upgrading to serverless 1.19.0. This was working fine with serverless 1.17.0. I get the same error with 1.18.0 also.

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.basename (path.js:1355:5)
    at R.map.R.over.artifact (/Users/dpandya/serverless-bsexample/node_modules/serverless-plugin-webpack/src/lib/service.js:30:48)
    at /Users/dpandya/serverless-bsexample/node_modules/ramda/src/over.js:37:47
    at /Users/dpandya/serverless-bsexample/node_modules/ramda/src/lens.js:35:9
    at over (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/over.js:37:56)
    at /Users/dpandya/serverless-bsexample/node_modules/ramda/src/internal/_curry3.js:26:46
    at f1 (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/internal/_curry1.js:17:17)
    at XWrap.f (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/map.js:53:20)
    at XWrap.module.exports.XWrap.@@transducer/step (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/internal/_xwrap.js:10:17)
    at _arrayReduce (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/internal/_reduce.js:11:36)
    at _reduce (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/internal/_reduce.js:44:14)
    at map (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/map.js:52:14)
    at /Users/dpandya/serverless-bsexample/node_modules/ramda/src/internal/_dispatchable.js:39:15
    at Object.f2 [as map] (/Users/dpandya/serverless-bsexample/node_modules/ramda/src/internal/_curry2.js:25:16)
    at Object.setFnsArtifacts (/Users/dpandya/serverless-bsexample/node_modules/serverless-plugin-webpack/src/lib/service.js:27:52)
    at fs.copy.then (/Users/dpandya/serverless-bsexample/node_modules/serverless-plugin-webpack/src/index.js:78:55)
From previous event:
    at PluginManager.invoke (/Users/dpandya/.nvm/versions/node/v7.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:236:22)
    at PluginManager.run (/Users/dpandya/.nvm/versions/node/v7.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:255:17)
    at variables.populateService.then (/Users/dpandya/.nvm/versions/node/v7.4.0/lib/node_modules/serverless/lib/Serverless.js:99:33)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
    at Serverless.run (/Users/dpandya/.nvm/versions/node/v7.4.0/lib/node_modules/serverless/lib/Serverless.js:86:74)
    at serverless.init.then (/Users/dpandya/.nvm/versions/node/v7.4.0/lib/node_modules/serverless/bin/serverless:39:50)

Here is my webpack.config.js

module.exports = {
  // entry: set by the plugin
  // output: set by the plugin
  target   : 'node',
  devtool: 'source-map',
  externals: [
    /aws-sdk/, // Available on AWS Lambda
  ],
  module   : {
    rules: [
      {
        test   : /\.js$/,
        // Exclude soacommonjs-4-lambda from exclusion (so effectively include it) as it needs to be included in
        // transpiling
        exclude: /node_modules\/(?!soacommonjs-4-lambda)/,
        loader : 'babel-loader',
        query  : {
          presets: [
            [
              'env', {
                target     : {node: 6.10}, // Node version on AWS Lambda
                useBuiltIns: true, // Prefer built in ES features as much as possible instead of using polyfills
                modules    : false, // See https://babeljs.io/docs/plugins/preset-env/#optionsmodules
                loose      : true,
              },
            ],
            'es2015',
            'stage-0',
          ],
        },
      },
    ],
  },
};

Versions:
Node: 7.4.0
Serverless: 1.19.0
serverless-plugin-webpack: 1.2.3

Should be fixed after merging PR #36.

Thanks @jogold. Waiting for the fix :)