serverless package is very slow

This is a (Bug Report / Feature Proposal)

Description

My project written in node and bundled with webpack. It has a lot of dependencies. We have over a dozen functions.

For bug reports:

  • What went wrong?
    Running 'serverless package' will run for 20 minutes before I just give up on it. It has been tolerable but slow for some time.

  • What did you expect should have happened?
    With out function and package configs, this should run in less than 30 seconds.

  • What was the config you used?
    Here are the relevant bits:

package:
  individually: true
  exclude:
    - "**"

functions:
  Function1:
    handler: modules/server/dist/app/handlers/Function1.handler
    memorySize: 256
    timeout: 300
    package:
      include:
      - modules/server/dist/app/handlers/Function1.js
      - modules/server/dist/app/handlers/Function1.js.map

  Function2:
    handler: modules/server/dist/app/handlers/Function2.handler
    memorySize: 256
    timeout: 300
    package:
      include:
      - modules/server/dist/app/handlers/Function2.js
      - modules/server/dist/app/handlers/Function2.js.map
  • What stacktrace or error message from your provider did you see?
    No errors or stack trace. The CPU goes to 100% until I stop the process 20 minutes later. One or two functions do eventually get packaged in .serverless.

Additional Data

  • Serverless Framework Version you're using:
    Confirmed this occurs in 1.18.0 and 1.22.0

  • Operating System:
    Ubuntu 17.04

It almost seems like the package code is walking the entire file system tree even though it has been explicitly told to ignore all files. I set the function's artifact to a manual zip file and sure enough the package process runs instantly.