2017-07-27 6 views
0

ファイルをS3バケットに配置した後に発生するAWS-Lambda関数があります。AWS-Lambda-FunctionでSSLリクエストを作成するには?

var http = require('http'); 

exports.handler = function (event, context) { 

var bucket = event.Records[0].s3.bucket.name; 
var key = event.Records[0].s3.object.key; 

var newKey = key.split('.')[0].slice(8); 

var url = 'https://xxxxx.herokuapp.com/api/messages/'+newKey+'/processingFinished' 
console.log("URL:" + url) 

    http.get(url, function (result) { 
    console.log('!!!! Success, with: ' + result.statusCode); 
    context.done(null); 
    }).on('error', function (err) { 
    console.log('Error, with: ' + err.message); 
    context.done("Failed"); 
    }); 
}; 

CloudWatchのログファイルには、私が苦情を参照してくださいHTTPSがサポートされていません:

は、これは私のラムダ関数である

2017-07-27T10:38:04.735Z 8428136e-72b7-11e7-a5b9-bd0562c862a0 Error: Protocol "https:" not supported. Expected "http:" 
at new ClientRequest (_http_client.js:54:11) 
at Object.exports.request (http.js:31:10) 
at Object.exports.get (http.js:35:21) 
at exports.handler (/var/task/index.js:18:8) 

しかし、記載されたURLは、任意のウェブブラウザで開くことができます。サーバーはSSLを受け入れ、SSL全体でAPI全体が機能しています。

なぜAWSはSSLリクエストを拒否していますか?これを解決するには?ノードドキュメント当たり

答えて

2

:(https://nodejs.org/api/https.html

HTTPSは、TLS/SSL上のHTTPプロトコルです。 Node.jsでは、これは別のモジュールとして実装されています。

使用

http = require('https'); 
関連する問題