Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 8656c83

Browse files
fix: Preventing that lambda webhook fails when it tries to process an installation_repositories event (#2288)
1 parent 72f99b7 commit 8656c83

File tree

1 file changed

+4
-5
lines changed
  • modules/webhook/lambdas/webhook/src/webhook

1 file changed

+4
-5
lines changed

Diff for: modules/webhook/lambdas/webhook/src/webhook/handler.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ export async function handle(headers: IncomingHttpHeaders, body: string): Promis
2929
return response;
3030
}
3131

32-
const payload = JSON.parse(body);
33-
LogFields.fields.event = githubEvent;
34-
LogFields.fields.repository = payload.repository.full_name;
35-
LogFields.fields.action = payload.action;
36-
3732
if (!supportedEvents.includes(githubEvent)) {
3833
logger.warn(`Unsupported event type.`, LogFields.print());
3934
return {
@@ -42,6 +37,10 @@ export async function handle(headers: IncomingHttpHeaders, body: string): Promis
4237
};
4338
}
4439

40+
const payload = JSON.parse(body);
41+
LogFields.fields.event = githubEvent;
42+
LogFields.fields.repository = payload.repository.full_name;
43+
LogFields.fields.action = payload.action;
4544
LogFields.fields.name = payload[githubEvent].name;
4645
LogFields.fields.status = payload[githubEvent].status;
4746
LogFields.fields.started_at = payload[githubEvent]?.started_at;

0 commit comments

Comments
 (0)