serverless-heaven / serverless-webpack

Serverless plugin to bundle your lambdas with Webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3.1.1 dropping some dependencies.

colinfindlay-nz opened this issue · comments

This is a Bug Report

Description

As of version 3.1.1 certain dependencies seem to be dropped from packaging. Currently seeing this with stateful.co - Not sure if because of full-stop, or something deeper in the package.json.

Generated package.json and resulting node-modules folder below (can produce a minimal example - but pressed for time atm):

less package.json
{
  "dependencies": {
    "babel-runtime": "^6.26.0",
    "aws-xray-lambda-promise-subsegment": "^1.1.0",
    "raven": "^2.1.2",
    "stateful.co": "^1.0.1"
  }
}
ls -1p node_modules
async/
async-listener/
aws-xray-lambda-promise-subsegment/
aws-xray-sdk/
aws-xray-sdk-core/
aws-xray-sdk-express/
aws-xray-sdk-mysql/
aws-xray-sdk-postgres/
babel-runtime/
colors/
continuation-local-storage/
cookie/
core-js/
cycle/
emitter-listener/
eyes/
isstream/
lsmod/
moment/
pkginfo/
raven/
regenerator-runtime/
semver/
shimmer/
stack-trace/
timed-out/
underscore/
winston/

Further info - the generated master package.json .webpack/dependencies/package.json contains:

    "stateful": {
      "co": "^1.0.1"
    }

Can confirm full stops in package names break things - not sure why it wasn't happening in 3.1.0

@silver2k Just had a brain flash.... I think I know what it is - The npm ls command used to fetch the dependency tree cuts the stdout as soon as its buffer is full. The default buffer size is 200K, which might be not enough if you have lots of dependencies.

There is a hidden setting for the plugin to increase the buffer size.
Can you try to set custom: packExternalModulesMaxBuffer: 614400 (600 KB) and check if it works then? If necessary increase the size further (I do not know if there's a physical limit).

In case this solves your problem, we should increase the default buffer size.

Regarding the package name parsing (full stops) I do not remember that there was any change, but I'll check it to be sure.

See comment above - it's definitely the fullstop in stateful.co being read as a nested dependency, rather than the full name.

@silver2k Thanks for the clarification. Flagged it as bug.

Found the issue in #246 (commented there). I'll provide a fixed release asap.

@silver2k Can you try with "serverless-webpack": "serverless-heaven/serverless-webpack#fix-modules-with-full-stop" if that fixes the problem? As soon as you report back, I'll prepare 3.1.2

I did a quick check with a test project that includes "stateful.co" and it worked for me with the fix.

Can confirm it's now working as expected

Released with 3.1.2