serverless-webpack: Path error with SLS 1.18 when package individually is set

This is a Bug Report

Description

I have a few services in the same project, so I made a script to gather the and deploy them one by one. On my machine everything goes fine, but when I run it on AWS CodeBuild, our CI, it fails.

projects.forEach(project => {
  console.info('Deploying', project);
  child_process.exec(`sls deploy`, { cwd: join(srcFolder, project) }, (err, stdout, stderr) => {
    if (err) {
      console.log('Error!', err);
    } else {
      console.log('STDOUT:', stdout);
      console.log('STDERR:', stderr);
      console.info('Finished', project);
    }
  });
});

And here is the error:

TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.basename (path.js:1357:5)
at functionNames.forEach.name (/codebuild/output/src838467009/src/node_modules/serverless-webpack/lib/cleanup.js:27:28)
at Array.forEach (native)
at fse.copy (/codebuild/output/src838467009/src/node_modules/serverless-webpack/lib/cleanup.js:23:31)
at doneOne (/codebuild/output/src838467009/src/node_modules/fs-extra/lib/copy/ncp.js:237:40)
at /codebuild/output/src838467009/src/node_modules/fs-extra/lib/copy/ncp.js:122:11
at /codebuild/output/src838467009/src/node_modules/graceful-fs/polyfills.js:239:18
at FSReqWrap.oncomplete (fs.js:123:15)

at ChildProcess.exithandler (child_process.js:202:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5) killed: false, code: 1, signal: null, cmd: 'sls deploy' }
  • Serverless-Webpack Version you’re using: ^2.0.0
  • Webpack version you’re using: ^3.3.0
  • Serverless Framework Version you’re using: ^1.17.0
  • Operating System: Should be Ubuntu

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

The error happens in the cleanup when package.individually has been set. See cleanup.js.

This maybe related to #120 - individual packaging does not work properly. According to the source, the function’s artifact property must be unset.

We should try to setup a simple project where it can be reproduced locally and then it should be solved together with #120.