I have a nodejs lambda function which essentially runs a set of tests in newman (A JS library of Postman). The tests run successfully but when the lambda is trying to send back a message to Codepipeline using codepipeline.putJobSuccessResult, it keeps throwing the maximum call stack exceeded error. The printed error stack doesn't seem to be very long (I can just see 6 lines printed).
Any help with how why the stack trace is exceeding and how it could be debugged easily would help.
Relevant exports.handler
exports.handler = function(event, context) {
var jobId = event["CodePipeline.job"].id;
console.log("Triggering tests for job "+ jobId);
var putJobSuccess = function(message) {
codepipeline.putJobSuccessResult({jobId: jobId}, (err, data) => {
if (err) {
context.fail(err);
} else {
context.succeed(message)
}
});
}
var putJobFailure = function(message) {
console.log("Tests failed for job: " + jobId);
var params = {
jobId: jobId,
failureDetails: {
message: JSON.stringify(message),
type: 'JobFailed',
externalExecutionId: ""
}
}
}
var testRunnerCallback = function(response) {
if (response === 1) {
putJobFailure("Tests failed. View logs for details");
} else {
putJobSuccess("All Tests passed");
}
}
Newman.execute(collections, newmanOptions, testRunnerCallback);
}
Thanks