Troubleshooting
Frequent error emails
If you frequently receive error emails with the message "We perform a total of 3 attempts, please fix urgently avoid notification lost." your endpoint probably takes too long to respond (more that 3 seconds).
The best method would be for you to reduce the execution time to within 3 seconds.
If you can't have a run time of less than 3 seconds, a workaround is to continue the background process.
Here is a PHP and NodeJS example to respond to the webhook and continue your background processing:
// Place on the beginning of your PHP script
ignore_user_abort(true);//not required
set_time_limit(0);
ob_start();
echo 'ok';
header('Connection: close');
header('Content-Length: '.ob_get_length());
ob_end_flush();
@ob_flush();
flush();
fastcgi_finish_request();
// Your code here
app.post('/my-endpoint', async function (req, res) {
var body = res.body;
res.status(200).send({ success: true });
await performComplexTasks(body);
})
async function performComplexTasks(body){
// Your code here
}
Updated over 2 years ago