MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / webhookHandler

Function webhookHandler

integrations/supabase/src/management/index.ts:803–865  ·  view source on GitHub ↗
(event: HandlerEvent<"HTTP">, logger: Logger)

Source from the content-addressed store, hash-verified

801}
802
803async function webhookHandler(event: HandlerEvent<"HTTP">, logger: Logger) {
804 logger.debug("[inside supabase management integration] Handling webhook handler");
805
806 const { rawEvent: request, source } = event;
807
808 if (!request.body) {
809 logger.debug("[inside supabase management integration] No body found");
810
811 return;
812 }
813
814 // Check the Bearer token matches the secret
815 const authHeader = request.headers.get("Authorization");
816
817 if (!authHeader) {
818 logger.debug("[inside supabase management integration] No Authorization header found");
819
820 return { events: [] };
821 }
822
823 const authHeaderParts = authHeader.split(" ");
824
825 if (authHeaderParts.length !== 2) {
826 logger.debug(
827 "[inside supabase management integration] Authorization header is not in the correct format"
828 );
829
830 return { events: [] };
831 }
832
833 const token = authHeaderParts[1];
834
835 if (token !== source.secret) {
836 logger.debug(
837 "[inside supabase management integration] Authorization header does not match the secret"
838 );
839
840 return { events: [] };
841 }
842
843 const rawBody = await request.text();
844
845 const payload = safeParseBody(rawBody);
846
847 if (!payload) {
848 return { events: [] };
849 }
850
851 // Generate a unique ID for the event
852 const id = randomUUID();
853
854 return {
855 events: [
856 {
857 id,
858 name: payload.type,
859 source: "supabase",
860 payload,

Callers

nothing calls this directly

Calls 4

safeParseBodyFunction · 0.90
debugMethod · 0.65
textMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…