问题
The problem
- I have a Python script running on AWS Lambda.
- This script is using
subprocess
to execute a NodeJS 4 script.
What have I tried
subprocess.check_output('my-script.js');
- Got a non-zero result
Got the interpreter error:
Version of node.js doesn't meet minimum requirement. Please ensure system has node.js version 4.0.0 or higher.
subprocess.check_output('node -v');
printed it's 0.10.x
My question
Is it possible to use a NodeJS 4 script from a Python AWS Lambda?
回答1:
You cannot rely on node
existing on the Lambda python
runtimes. AWS might remove or change it any time.
It would be best if you just translate them into one language so you only need one runtime. Either translate the node script into python or translate the python script to node.
If translation is not feasible, you can create two Lambda functions -- one in Python and one in Node. You can then have the Python Lambda invoke the Node Lambda using .invoke()
来源:https://stackoverflow.com/questions/46716105/using-a-nodejs-4-script-from-python-on-aws-lambda