Unable to run openssl via child_process call in Node.js 10x

0

I am trying to call openssl from my lambda function but am getting the following error:
Command failed: openssl: command not found

openssl is part of Amazon Linux so I'm not sure why this isn't working (I confirmed this works with Python 3.7 environment). Any help would be greatly appreciated!

Here is a sample of my code:

const exec = require('child_process').exec
const fs = require("fs")
exports.handler = async function (event, context, callback) {
exec('openssl help', (error, stdout, stderr) => {
if (error) {
throw error
}
callback(null, "success")
})
}

Edited by: gstclair on Jun 28, 2019 2:57 PM

質問済み 5年前1462ビュー
2回答
0
承認された回答

For anybody having this same issue, openssl wasn't present in the Node.js container. We switched to Python, which had openssl.

回答済み 4年前
0

Hello,
Yes, I have tested OpenSSL 1.0.2k, in nodejs12.x lambda runtime with custom layer codebase, it's working fine.

Here, the link I follow, to add a custom layer to lambda.  
Reference Links:  
1. https://stackoverflow.com/questions/58548580/npm-package-pem-doesnt-seem-to-work-in-aws-lambda-nodejs-10-x-results-in-ope/58965884#58965884  
2. https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html  
3. https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html?icmpid=docs_lambda_rss  
4. Sample Code: https://docs.aws.amazon.com/lambda/latest/dg/lambda-nodejs.html  

If you want to upgrade the OpenSSL version anyhow, then you should refer: https://stackoverflow.com/questions/36468984/aws-lambda-python-libssl-c-library - I have also tested his, it's works well.
回答済み 4年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ