Using a NodeJS 4 script from Python on AWS Lambda

落爺英雄遲暮 提交于 2019-12-12 18:21:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!