Transformation and Routing in TYK

Thanks Leon. I have added the code to the virtual endpoint plugin but the error: “Failed to run JS middleware” still persist. Below is a part of my tyk.conf file; kindly check if I have done something wrong:

“hostname”: “”,
“enable_custom_domains”: true,
“proxy_enable_http2”: true,
“enable_jsvm”: true,
“jsvm_timeout”: 120,
“oauth_redirect_uri_separator”: “;”,
“coprocess_options”: {
“enable_coprocess”: true,
“coprocess_grpc_server”: “”,
“python_path_prefix”: “/opt/tyk-gateway”
},
“enable_bundle_downloader”: true,
“bundle_base_url”: “http://.host.example.com:8080”,

Also, below is the modified javascript in the virtual endpoint plugin:
function myAttempt(request, session, config) {
newRequest = {
“Method”: “POST”,
“Body”: request.Body,
“Headers”: {“x-ibm-client-id”:“94ce312c-4aab-4365-ad2a-aae945990518”},
“Domain”: “https://api.fcmb.com/fcmb/test/v1/wallet/Customerwallet/new”,

};
//response = TykMakeHttpRequest(newRequest);
response = TykMakeHttpRequest(JSON.stringify(newRequest));
usableResponse = JSON.parse(response);
//var bodyObject = JSON.parse(usableResponse.Body);

var responseObject = {
Body: usableResponse.Body,
Code: usableResponse.Code,
Headers: {}
}

    for (var k in usableResponse.Headers) {
      if (usableResponse.Headers.hasOwnProperty(k)) {
        responseObject.Headers[k] = usableResponse.Headers[k]
      }
    }

    return TykJsResponse(responseObject, {})

//return TykJsResponse(bodyObject, session.meta_data)
//return TykJsResponse(response, session.meta_data);
}

Thanks.