I'd like to call a python function from within a Google cloud function like so:
`shell.exec(`${PYTHON_FUNCTION} parameters`, function(code, stdout, stderr) {`
Is this possible? And if so how would I do it?
Thank you very much
Cloud Functions code runs inside a container that is set up for specific environments. For example, in your question, you are using the Node.js execution environment.
Your goal is to call a Python function (script) from Node.js. This would require the Python interpreter, libraries, and a correctly set up environment.
The Cloud Functions Node.js execution environment does not include the Python execution environment. Therefore the answer is not possible using Google provided execution environments.
If you would like to combine Node.js and Python, I recommend creating a custom Cloud Run container and deploying to Cloud Run, which is the big brother to Cloud Functions.
shell.execwould require the Python program, libraries, and environment to run a Python function. The Cloud Functions node.js environment does not include Python.