这里是我在nodeJS中的代码。当我将它部署到我的本地时,它始终运行正常,但是当我在生产中部署它时,我总是遇到错误" ArrayBuffer未定义" 。有人能告诉我它是什么造成的吗?我试图添加ArrayBuffer,但我得到了同样的错误。谢谢
var svr = http.createServer(function(req, resp) {
var response = [];
var calls = [];
var windowLiveId;
var huaweiReturnCode;
var serviceId = apigeeAccess.getVariable(req,'subscription.serviceid');
var ericssonRequestBody = {"offerId":serviceId,"generateBillingRecord":true };
calls.push(function(callback) {
http.get('http://butcha-test.apigee.net/v1/accounts/', function (resource) {
resource.setEncoding('binary');
resource.on('data', function (data) {
windowLiveId = JSON.parse(data).AccountId;
request.post({
url:'http://butcha-test.apigee.net/v1/erickson/'+windowLiveId,
method: 'POST',
headers:{
'Content-Type': 'application/json'
},
body: JSON.stringify(ericssonRequestBody)
}, function(error,res,body){
apigeeAccess.setVariable(req,"ericsonStatus",(/2[0-9][0-9]/.test(res.statusCode)) ? "success":"fail");
apigeeAccess.setVariable(req,"ericsonStatusCode",res.statusCode);
callback();
});
});
});
});
calls.push(function(callback){
request.post({
url:'http://morning-sea-3467.getsandbox.com/mockOverseaBossServiceSoapBinding',
method: 'POST',
headers: {'content-type' : 'application/xml'},
body: huaweiSoapRequest
}, function(error,res,body){
response.push(body);
var tag = "<bean:returnCode>";
var x = body.indexOf(tag) + tag.length;
huaweiReturnCode = body.substring(x, (x+1));
apigeeAccess.setVariable(req,"huaweiReturnCode",huaweiReturnCode);
apigeeAccess.setVariable(req,"huaweiStatusResult",(huaweiReturnCode =="0")? "success":"fail");
callback();
});
});
async.parallel(calls, function(){
resp.end(str2ab(response.toString));
});
});
答案 0 :(得分:0)
也许是因为你的Apigee的版本?因为不支持较旧版本的Apigee nodeJs