After upgrading my DSP to 1.9 all my Server-Side script return 500 errors.
Trying to debug it to find the cause but posting in case somebody else has seen this issue and fixed it.
After upgrading my DSP to 1.9 all my Server-Side script return 500 errors.
Trying to debug it to find the cause but posting in case somebody else has seen this issue and fixed it.
The problem seems to point to a change in the data being sent to the ‘post_process’ script!?
I was using the following script successfully pre-1.9 but it causes a 500 error (internal server error) in 1.9.
Basically I send a GET request from my iOS app and pass in some filters, then in the ‘post_process’ script I check to make sure the original call is asking to be post processed, then check if an entry exists to increment otherwise I create an entry.
Any ideas?
if (event.request){
var request = event.request.body;
event.response.postprocessed = (request.postprocess);
if (request.postprocess){
event.response.getcount = event.response.record.length;
if (event.response.record.length>0){
_.each(event.response.record, function(record){
record.sum = Number(record.sum) + Number(request.sum);
var _patchs = platform.api.patch("db/bsoc_applaunch", record);
});
}else{
var _posts = platform.api.post("db/bsoc_applaunch",{
"record":[
{
"uuid": request.uuid,
"date": request.date,
"sum": request.sum
}
]
});
event.response.postcount = _posts.record.length;
}
}
}
Some more info:
When the script hits the ‘***platform.api.post(…)***’ call it falls over with the 500 error, and when it hits the ‘***platform.api.patch(…)***’ call it does not give an error but the database is NOT patched with the new value even tough the the ‘record’ object is correctly showing the updated value of the ‘sum’ field.
If you’ve not already, have a look in:
/path/to/dsp/log/web.dsp_host_name.log
That’ll give you some more info on what’s gone wrong.
Ok, fixed it!
Found that in DSP 1.9 I had to switch the user Roles Access’ Requestor to “API & SCRIPT”.
Not sure why this was working before, either the Access controls have been tightened up in 1.9 or my user setting got clobbered during upgrade.
Thanks for help pointers!!!