serverless / serverless-optimizer-plugin

Serverless Optimizer Plugin: Optimizers for reducing Lambda file sizes and improving their performance -
http://www.serverless.com
102 stars 30 forks source link

Error trying to deploy single function #60

Closed electric-al closed 2 years ago

electric-al commented 2 years ago

Hi there.

Using version 4.2.1-rc.1 of serverless-optimizer-plugin and serverless versions:

Framework Core: 2.55.0 (local) Plugin: 5.5.1 SDK: 4.3.0 Components: 3.18.1

Other plugins:

  - serverless-domain-manager
  - serverless-offline
  - serverless-plugin-optimize
  - serverless-iam-roles-per-function

Using:

sls deploy function -f <name> --stage=<stage>

Results in:

SyntaxError: Assigning to rvalue (1:62403) while parsing ***/serverless_sdk/index.js while parsing file: ***/serverless_sdk/index.js
      at DestroyableTransform.end [as _flush] (***:21)
      at DestroyableTransform.prefinish (***/_stream_transform.js:138:10)
      at DestroyableTransform.emit (events.js:400:28)
      at DestroyableTransform.emit (domain.js:470:12)
      at prefinish (***/node_modules/readable-stream/lib/_stream_writable.js:619:14)
      at finishMaybe (***/monorepo/node_modules/readable-stream/lib/_stream_writable.js:627:5)
      at endWritable (***/monorepo/node_modules/readable-stream/lib/_stream_writable.js:638:3)
      at DestroyableTransform.Writable.end (***/node_modules/readable-stream/lib/_stream_writable.js:594:41)
      at BabelifyStream.onend (internal/streams/readable.js:665:10)
      at Object.onceWrapper (events.js:519:28)
      at BabelifyStream.emit (events.js:400:28)
      at BabelifyStream.emit (domain.js:470:12)
      at endReadableNT (internal/streams/readable.js:1317:12)
      at processTicksAndRejections (internal/process/task_queues.js:82:21)

However it works if we set optimise:false on the function (which is not ideal).

Any idea how to make it work without yml changes?

electric-al commented 2 years ago

Also tried with latest serverless:

Serverless: Running "serverless" installed locally (in service node_modules)
Framework Core: 2.68.0 (local)
Plugin: 5.5.1
SDK: 4.3.0
Components: 3.18.1