fix: no webhook secret found?

This commit is contained in:
Andras Bacsai 2022-03-15 17:35:37 +01:00
parent 4b521ceedc
commit abe92dedff

View File

@ -47,7 +47,7 @@ export const post: RequestHandler = async (event) => {
const applicationFound = await db.getApplicationWebhook({ projectId, branch }); const applicationFound = await db.getApplicationWebhook({ projectId, branch });
if (applicationFound) { if (applicationFound) {
const webhookSecret = applicationFound.gitSource.githubApp.webhookSecret; const webhookSecret = applicationFound.gitSource.githubApp.webhookSecret || null;
const hmac = crypto.createHmac('sha256', webhookSecret); const hmac = crypto.createHmac('sha256', webhookSecret);
const digest = Buffer.from( const digest = Buffer.from(
'sha256=' + hmac.update(JSON.stringify(body)).digest('hex'), 'sha256=' + hmac.update(JSON.stringify(body)).digest('hex'),