2017-07-27 29 views
0

我有一個AWS-Lambda函數,在將文件放入S3-Bucket後觸發Gots。如何使用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並且整個API都按照SSL工作。

爲什麼AWS拒絕SSL請求?如何解決這個問題?

回答