Serverless-python-requirements: Packaging fails with Serverless Version 1.61.x

Created on 21 Jan 2020  路  15Comments  路  Source: UnitedIncome/serverless-python-requirements

After upgrading the Serverless Framework Version to 1.61.x the packaging fails with the following error:

Serverless: Generated requirements from /path/to/requirements.txt in /path/to/.serverless/requirements.txt...
Serverless: Using static cache of requirements found at /home/ubuntu/.cache/serverless-python-requirements/98230c43d557f2de15b2896aab825590e262c81f5024fe42d48dbe9c4f848587_slspyc ...
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...

Type Error ---------------------------------------------

TypeError: Cannot read property 'length' of undefined
at DataWorker.emit (/path/to/node_modules/jszip/lib/stream/GenericWorker.js:121:54)
at DataWorker.end (/path/to/node_modules/jszip/lib/stream/GenericWorker.js:65:18)
at DataWorker._tick (/path/to/node_modules/jszip/lib/stream/DataWorker.js:92:21)
at DataWorker._tickAndRepeat (/path/to/node_modules/jszip/lib/stream/DataWorker.js:72:10)
at Immediate. (/path/to/node_modules/jszip/lib/utils.js:381:18)
at processImmediate (internal/timers.js:439:21)
at process.topLevelDomainCallback (domain.js:130:23)

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information ---------------------------
Operating System: linux
Node Version: 12.13.1
Framework Version: 1.61.2
Plugin Version: 3.2.7
SDK Version: 2.3.0
Components Core Version: 1.1.2
Components CLI Version: 1.4.0

bug

All 15 comments

I ran into the same issue. Resolved with:
npm i -g serverless@"<1.61.0"

Same problem with serverless version 1.63.0. Downgrade to version 1.60.5 fixes the problem temporarily.

It's still happening in 1.67.0.

this seems to be resolved in serverless 1.69.3

Can anyone else confirm?

Right now I can just find version 1.69.0 and this one doesn't still work in my case

i was incorrect. serverless version 1.69.0 that is working for me now

version 5.1.0 of serverless-python-requirements

{
  "serverless": "^1.69.0",
  "serverless-python-requirements": "^5.1.0"
}

Works for me after I delete the yarn.lock file and the node_modules folder.

Even after deleting the lock file and the node modules folder I get the following output:

Serverless: Generated requirements from ./requirements.txt in .serverless/requirements.txt...
Serverless: Using static cache of requirements found at /Users/xxx/Library/Caches/serverless-python-requirements/98230c43d557f2de15b2896aab825590e262c81f5024fe42d48dbe9c4f848587_slspyc ...
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...

  Type Error ---------------------------------------------

  TypeError: Cannot read property 'length' of undefined
      at DataWorker.emit (/Users/xxx/dev/repos/auth/node_modules/jszip/lib/stream/GenericWorker.js:121:54)
      at DataWorker.end (/Users/xxx/dev/repos/auth/node_modules/jszip/lib/stream/GenericWorker.js:65:18)
      at DataWorker._tick (/Users/xxx/dev/repos/auth/node_modules/jszip/lib/stream/DataWorker.js:92:21)
      at DataWorker._tickAndRepeat (/Users/xxx/dev/repos/auth/node_modules/jszip/lib/stream/DataWorker.js:72:10)
      at Immediate.<anonymous> (/Users/xxx/dev/repos/auth/node_modules/jszip/lib/utils.js:381:18)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:137:15)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

     Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

     Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              14.1.0
     Framework Version:         1.69.0
     Plugin Version:            3.6.9
     SDK Version:               2.3.0
     Components Version:        2.30.6

Should I may use a different node version? Any suggestion would be appreciated.

This is my environment:

~/src$ node --version
v13.12.0

~/src$ serverless --version
Framework Core: 1.69.0
Plugin: 3.6.9
SDK: 2.3.0
Components: 2.30.5

Also still seeing this with serverless 1.7.0 and serverless-python-requirements 5.1.0:

Serverless: Injecting required Python packages to package...

  Type Error ---------------------------------------------

  TypeError: Cannot read property 'length' of undefined
      at DataWorker.emit (/xxx/node_modules/jszip/lib/stream/GenericWorker.js:121:54)
      at DataWorker.end (/xxx/node_modules/jszip/lib/stream/GenericWorker.js:65:18)
      at DataWorker._tick (/xxx/node_modules/jszip/lib/stream/DataWorker.js:92:21)
      at DataWorker._tickAndRepeat (/xxx/node_modules/jszip/lib/stream/DataWorker.js:72:10)
      at Immediate.<anonymous> (/xxx/node_modules/jszip/lib/utils.js:381:18)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:137:15)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.16.3
     Framework Version:         1.70.0
     Plugin Version:            3.6.11
     SDK Version:               2.3.0
     Components Version:        2.30.10

Can also confirm that 1.60.5 works without any issues

The combination of serverless 1.71.1 / Node 12.16.3 works for me; whereas serverless 1.64.0 did not work (which matches the reports above that the problem started in 1.61.0 probably). All using serverless-python-requirements 5.1.0.

I am still plagued with this issue. I have been locked on version 1.35.1 of serverless and each time i got to upgrade i have this issue. Any traction on resolving this issue?

@dschep Are you aware of any work around for this? Or any insight on what the root cause might be? Seems like I have been locked on a old version of serverless long enough that its causing a problem for me. I'm assuming this issue doesn't plague everyone or there would be much more traction. The stack doesn't mean much to me but i can make some educated guesses that this is during the zip process and that maybe the list of files to zip is undefined?

Today i noticed that if i remove the serverless-s3-sync that this issue is resolved.

I think in my case the reason for that error was that I added manually some plugins in plugin section of serverless.yaml

plugins:
  - serverless-plugin-scripts
  - serverless-tag-cloud-watch-logs
  - serverless-python-requirements <= added manually

After deleting it and adding with sls plugin install --name plugin-name everything went fine. Hope it will help sb.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JulienMarliac picture JulienMarliac  路  3Comments

IanTayler picture IanTayler  路  4Comments

simplesteph picture simplesteph  路  5Comments

doublemarked picture doublemarked  路  3Comments

nknotts picture nknotts  路  5Comments