Python dependencies for serverless plugin are not handled properly

python
serverless

(Prapoorna Kotha) #1

Tried to use serverless plugin and use an action from exchange.
Action: “GET” from servicenow pack

Encountered several errors with python dependencies using serverless. Here is an example attached:

Observations:
python dependencies are not built/copied into virtual environments folder during deployment in the serverless package although they are specified in the requirements.txt and the modules exist in the system.

For the “GET” action in servicenow pack, the only dependency listed was “pysnow” which was part of the virtual environments in the package. However, when invoke command is run, it complained: ‘~st2/handler’: No module named six

When six was installed and added to requirements.txt, six module wasn’t copied to the virtual environments.
I had to manually copy the module to the virtual environments, redeploy and invoke.
This time it complained: ‘~st2/handler’: No module named oslo_config
Repeated above steps and next it complained ‘~st2/handler’: No module named enum
And assuming its a repetitive process until all dependencies are satisfied and I stopped at this point and couldn’t successfully invoke the action.

Questions:

  1. Where are the dependencies listed for an action with serverless plugin? Does serverless create a wrapper and has more internal dependencies, if so what are they? Cause they only show up during invocation and its hard to figure out
  2. When an action is cloned from exchange during serverless deployment, should we assume the dependencies are already listed in requirements.txt?
  3. What are actions to be taken to handle the dependencies? Clearly manual copy is not an option.
    Looking for a list and automated procedure that is handled during serverless deployment.

(Eugen C.) #2

As answered in Slack, since your OS env is Darwin, there were previous issues with trying StackStorm serverless plugin under macOS:

I’d suggest to try it in another environment like Ubuntu Xenial (VM/Vagrant) and check if those errors persist.