in lambda/apigw-sap-idoc-s3/index.js [20:49]
exports.handler = function(event, context, callback) {
try{
var qp = event.queryStringParameters
if(!qp.bn || qp.bn==""){
console.log("S3 bucket not provided in the request", qp)
callback(getResponse(400,"S3 bucket not provided in the request. Hence can't store the data to S3"),null)
}
var rc = event.requestContext
if(!rc){
console.log("Request Context is empty", rc)
callback(getResponse(400,"Request Context cannot be empty. Need the request ID for the file name"),null)
}
if(!rc.requestId || rc.requestId==""){
console.log("File name is obtained from event.requestContext.requestId is empty",rc)
callback(getResponse(400,"File name cannot be empty. File name is obtained from event.requestContext.requestId. Hence can't store the data to S3"),null)
}
var s3key = rc.requestId;
var result = event.body;
console.log(result); //XML
storeItem(qp, callback, s3key, result, "text/xml");
}catch(e){
console.log("Lambda Execution Error", e)
callback(getResponse(400,JSON.stringify(e)),null)
}
}