Transformation and Routing in TYK

I tried mapping accountToDebit with sourceAccount in virtual endpoint with the code snippet below

var payload = {};
payload.sourceAccount = JSON.parse(request.Body).accountToDebit;
payload.narration = JSON.parse(request.Body).purpose;
newRequest = {

    "Method": "POST",

    "Body": payload }

but It is giving this error: Error during virtual endpoint execution.
Kindly assist.