Serverless-python-requirements: TypeError: Cannot read property 'toString' of null

Created on 30 Aug 2017  路  3Comments  路  Source: UnitedIncome/serverless-python-requirements

sls deploy -v

Serverless: Parsing Python requirements.txt
Serverless: Installing required Python packages for runtime python3.6...

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

  Cannot read property 'toString' of null

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

  Stack Trace --------------------------------------------

TypeError: Cannot read property 'toString' of null
    at BbPromise (C:\Users\ceefour\git\node_modules\serverless-python-requirements\index.js:98:30)
    at ServerlessPythonRequirements.installRequirements (C:\Users\ceefour\git\node_modules\serverless-python-requirements\index.js:
86:12)
    at ServerlessPythonRequirements.packRequirements (C:\Users\ceefour\git\node_modules\serverless-python-requirements\index.js:135
:17)
From previous event:
    at PluginManager.invoke (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:242:22)
    at PluginManager.spawn (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:254:17)
    at Deploy.BbPromise.bind.then.then (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\plugins\deploy\deploy.js:1
01:50)
From previous event:
    at Object.before:deploy:deploy [as hook] (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\plugins\deploy\deplo
y.js:99:10)
    at BbPromise.reduce (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:242:55)
From previous event:
    at PluginManager.invoke (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:242:22)
    at PluginManager.run (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:261:17)
    at variables.populateService.then (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:99:33)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at Serverless.run (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:86:74)
    at serverless.init.then (C:\Users\ceefour\AppData\Roaming\npm\node_modules\serverless\bin\serverless:39:50)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     win32
     Node Version:           6.11.2
     Serverless Version:     1.20.2

requirements.txt:

psycopg2 #no-deploy
requests
-e git+https://github.com/mobolic/facebook-sdk.git#egg=facebook-sdk
pyjwt

Most helpful comment

I got the same error Cannot read property 'toString' of null with ubuntu 16.04, which has python3 and python3.5 but no python3.6

Upgraded like this:

~
npm install https://github.com/UnitedIncome/serverless-python-requirements/tarball/v3.0.0-beta.3
~

Next attempt:

~~~
$ SLS_DEBUG=1 serverless deploy -v
Serverless: Installing required Python packages for runtime python3.6...

Error --------------------------------------------------

python3.6 not found! Try the pythonBin option.
~~~

OK, at least that's clear, so I added

~
custom:
pythonRequirements:
pythonBin: /usr/bin/python3
~

Next error:

~~~
$ SLS_DEBUG=1 serverless deploy -v
Serverless: Installing required Python packages for runtime python3.6...

Error --------------------------------------------------

/usr/bin/python3: No module named pip
~~~

Solution: sudo apt-get install python3-pip --no-install-recommends

After that it's happy. So I think the beta is good, thank you!

All 3 comments

Could you try 3.0.0-beta.2? It has better error handling around calling pip and allows you to specify a python binary which I think is required for this plugin to work on windows (IIRC there isn't a python3.6.exe in the windows install of Python).

I got the same error Cannot read property 'toString' of null with ubuntu 16.04, which has python3 and python3.5 but no python3.6

Upgraded like this:

~
npm install https://github.com/UnitedIncome/serverless-python-requirements/tarball/v3.0.0-beta.3
~

Next attempt:

~~~
$ SLS_DEBUG=1 serverless deploy -v
Serverless: Installing required Python packages for runtime python3.6...

Error --------------------------------------------------

python3.6 not found! Try the pythonBin option.
~~~

OK, at least that's clear, so I added

~
custom:
pythonRequirements:
pythonBin: /usr/bin/python3
~

Next error:

~~~
$ SLS_DEBUG=1 serverless deploy -v
Serverless: Installing required Python packages for runtime python3.6...

Error --------------------------------------------------

/usr/bin/python3: No module named pip
~~~

Solution: sudo apt-get install python3-pip --no-install-recommends

After that it's happy. So I think the beta is good, thank you!

I got the same error. After I installed v3.0.0-beta.4 it works.

Your Environment Information -----------------------------
     OS:                     win32
     Node Version:           6.10.3
     Serverless Version:     1.17.0
Was this page helpful?
0 / 5 - 0 ratings

Related issues

chinalikai picture chinalikai  路  5Comments

doublemarked picture doublemarked  路  3Comments

gutyril picture gutyril  路  5Comments

davegravy picture davegravy  路  5Comments

bsamuel-ui picture bsamuel-ui  路  3Comments