Distributed Cron Task
Workflow
Setup


Authentifie Cron Task request
Last updated


Last updated
import {
HEADER_SIGNATURE_NAME,
SIGNATURE_ALGORITHM,
} from '@abyss-project/monitor';
const headerSignature = req.headers[HEADER_SIGNATURE_NAME];
const hmac = crypto.createHmac(
SIGNATURE_ALGORITHM,
"my-secret-signature",
);
const signature = hmac.update(JSON.stringify(req.body)).digest('hex');
if (headerSignature !== signature) {
// Throw an error
throw new Error('Invalid Signature');
}
// The signature is correct
// Response with the requestId of the AbyssMonitor logger to link logs to the cronTask
// ex: res.status(200).json(getRequestContext().requestId);