Hello, I am trying to configure an orders hook to consume orders updates. But, although I am answering it with status code 200, I am receiving status 502 through the hook config endpoint with the following message:
{"errorType":"TypeError","errorMessage":"res.setHeader is not a function" ...
I tried with both a python function and a javascript function. Here is the js code I am using:
exports.main = (req, res) => {
const secret = process.env.SECRET;
const incomingSecret = req.header('Secret');
if (incomingSecret !== secret) {
console.error(`Unauthorized`);
res.status(401).end();
return;
}
console.log('Webhook received:', req.body);
res.status(200).end();
};
The Hook seems to be successfully configured because I received some orders there, but I want to be sure the API will be able to retry when and just when needed.