serverless: npm 8 / Node 16 produces deployments zip's too large to deploy (50meg), npm 6 / Node 12 fine (12meg)

Are you certain it’s a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest version?

  • Yes, I’m using the latest version

Is there an existing issue for this?

  • I have searched existing issues, it hasn’t been reported yet

Issue description

Node 16 with NPM 8 generates deployment packages far too big - >50meg

Appears to be including things like aws-sdk that are not required.

Exact sane project using Node 12 NPM 6 produces ~12meg

Service configuration (serverless.yml) content

N/A

Command name and used flags

serverless package

Command output

$ node -v; npm version ; sls --version; sls package ; ls -laht .serverless/*zip
v16.14.0
{
  'lone-star': '1.0.0',
  npm: '8.3.1',
  node: '16.14.0',
  v8: '9.4.146.24-node.20',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1m+quic',
  cldr: '40.0',
  icu: '70.1',
  tz: '2021a3',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}
Running "serverless" from node_modules
Framework Core: 1.63.0
Plugin: 3.3.0
SDK: 2.3.0
Components Core: 1.1.2
Components CLI: 1.4.0
Running "serverless" from node_modules
 
 Serverless Warning --------------------------------------
 
  A valid SSM parameter to satisfy the declaration 'ssm:/XX/jwt/secret/v1~true' could not be found.
 
 
 Serverless Warning --------------------------------------
 
  A valid SSM parameter to satisfy the declaration 'ssm:/XX/jwt/secret/v2~true' could not be found.
 
 
 Serverless Warning --------------------------------------
 
  A valid SSM parameter to satisfy the declaration 'ssm:/rds/our_db/user/incentives-sls/password~true' could not be found.
 
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Warning: Not deploying alerts on stage v1
-rw-r--r-- 1 tchiverton domain^users 49M Mar 17 11:14 .serverless/lone-star.zip


$ nvm use 12

$ node -v; npm version ; sls --version; sls package ; ls -laht .serverless/*zip
v12.22.9
{
  'lone-star': '1.0.0',
  npm: '6.14.15',
  ares: '1.18.1',
  brotli: '1.0.9',
  cldr: '37.0',
  http_parser: '2.9.4',
  icu: '67.1',
  llhttp: '2.1.4',
  modules: '72',
  napi: '8',
  nghttp2: '1.41.0',
  node: '12.22.9',
  openssl: '1.1.1m',
  tz: '2019c',
  unicode: '13.0',
  uv: '1.40.0',
  v8: '7.8.279.23-node.56',
  zlib: '1.2.11'
}
Running "serverless" from node_modules
Framework Core: 1.63.0
Plugin: 3.3.0
SDK: 2.3.0
Components Core: 1.1.2
Components CLI: 1.4.0
Running "serverless" from node_modules
 
 Serverless Warning --------------------------------------
 
  A valid SSM parameter to satisfy the declaration 'ssm:/XX/jwt/secret/v2~true' could not be found.
 
 
 Serverless Warning --------------------------------------
 
  A valid SSM parameter to satisfy the declaration 'ssm:/XX/jwt/secret/v1~true' could not be found.
 
 
 Serverless Warning --------------------------------------
 
  A valid SSM parameter to satisfy the declaration 'ssm:/rds/our_db/user/incentives-sls/password~true' could not be found.
 
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Warning: Not deploying alerts on stage v1
-rw-r--r-- 1 tchiverton domain^users 15M Mar 17 11:13 .serverless/lone-star.zip

Environment information

See above

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for your advice @pgrzesik! I’m this case it’s more appropriate to be a library so we’ll try removing the peer dependency.