Are you using the latest jsreport,or at least the v2 version?
The script hooks have different signature there. See the docs
https://jsreport.net/learn/scripts
Your script should look like this
var request = require('request');
function beforeRender(req, res, done){
console.log('hello');
request({
url:"http://127.0.0.1:8000/api/receipts/1",
method: "POST",
json:true,
headers: {'User-Agent':'Super Agent/0.0.1','content-type': 'application/json','Content-Length': 92},
},function(err, response, body){
console.log(body);
req.data = {posts:body};
console.log(req.data);
done();
})
}