i’m trying to add a response status code in the response object instead of defining in the response body as
{
statusCode : 404 ,
data: { }
}
exports = function({ query, headers, body} , response) {
try{
console.log(“response -->” ,response);
response.setStatusCode(404);
response.setHeader(‘Content-Type’, ‘application/json’);
return response;
}
catch(e){
return e;
}
};
corresponding response :
ran at 1718340940221
took 160.456402ms
logs:
response → undefined
result:
{
“message”: “Cannot access member ‘setStatusCode’ of undefined”,
“name”: “TypeError”
}
result (JavaScript):
EJSON.parse(‘{“message”:"Cannot access member 'setStatusCode’ of undefined",“name”:“TypeError”}')