MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / createOpenApiContext

Function createOpenApiContext

app/src/server/api/internal/openApiTrpc.ts:13–27  ·  view source on GitHub ↗
(opts: CreateNextContextOptions)

Source from the content-addressed store, hash-verified

11const Sentry = ensureDefaultExport(SentryModule);
12
13export const createOpenApiContext = (opts: CreateNextContextOptions) => {
14 const { req } = opts;
15
16 const authenticatedSystemKey = req.headers.authorization?.split(" ")[1] as string | null;
17
18 if (!authenticatedSystemKey) {
19 throw new TRPCError({ code: "UNAUTHORIZED", message: "Missing System Key" });
20 }
21
22 if (authenticatedSystemKey !== env.AUTHENTICATED_SYSTEM_KEY) {
23 throw new TRPCError({ code: "UNAUTHORIZED", message: "Invalid System Key" });
24 }
25
26 return {};
27};
28
29export type TRPCContext = Awaited<ReturnType<typeof createOpenApiContext>>;
30

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected