Skip to content

Commit

Permalink
cron: remove debug
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz committed Jan 3, 2025
1 parent f74c0f8 commit 36e986c
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions app/api/cron/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,9 @@ export async function POST(req: Request) {
throw new Error("CRON_API_KEY is not defined");
}

const auth = req.headers.get("Authorization");
if (auth !== `Bearer ${process.env.CRON_API_KEY}`) {
logError("api/cron: Unauthorized", {
req: {
len: auth?.length,
pref: auth?.substring(0, 10),
suf: auth?.substring(auth.length - 3),
},
env: {
len: process.env.CRON_API_KEY?.length,
pref: process.env.CRON_API_KEY?.substring(0, 3),
suf: process.env.CRON_API_KEY?.substring(
process.env.CRON_API_KEY.length - 3,
),
},
});
if (
req.headers.get("Authorization") !== `Bearer ${process.env.CRON_API_KEY}`
) {
return Response.json({ message: "Unauthorized" }, { status: 401 });
}

Expand Down

0 comments on commit 36e986c

Please sign in to comment.