I have deployed a node js
app to AWS lambda
. I have the following code in my test event :
function getRoutes(callback){
request('http://localhost/php-rest/api.php/routes?filter=route_short_name', function(error, response, body) {
if (!error && response.statusCode == 200) {
message = JSON.stringify(JSON.parse(body));
return callback(message, false);
} else {
return callback(null, error);;
}
});
}
app.get('/getRoutes', function(req, res) {
getRoutes(function(err, data){
if(err) return res.send(err);
res.send(data);
});
});
I got the following error when I tried to save that:
There is an error in your JSON event. Please correct it before saving.
This is the configuration of lambda function you have created. So click on the lambda function first. After that you will get a window called function code. There you have to write you handler. After that you can test like you did before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With