Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

edit import cron body

Steven Teycafd029d0fb4
diff --git a/app/api/cron/import/route.ts b/app/api/cron/import/route.ts
index 7fea249714..12edb6fabc 100644
--- a/app/api/cron/import/route.ts
+++ b/app/api/cron/import/route.ts
@@ -12,10 +12,11 @@ const receiver = new Receiver({
});
export async function POST(req: Request) {
+ const body = await req.json();
if (process.env.NODE_ENV === "production") {
const isValid = await receiver.verify({
signature: req.headers.get("Upstash-Signature") || "",
- body: "",
+ body: JSON.stringify(body),
});
if (!isValid) {
return new Response("Unauthorized", { status: 401 });
@@ -23,8 +24,7 @@ export async function POST(req: Request) {
}
try {
- const data = await req.json();
- const { provider, projectId, bitlyGroup, keepTags } = data;
+ const { provider, projectId, bitlyGroup, keepTags } = body;
if (provider === "bitly") {
const bitlyApiKey = await redis.get(`import:bitly:${projectId}`);
let tagsToId;
@@ -67,7 +67,7 @@ export async function POST(req: Request) {
);
}
await importLinksFromBitly({
- ...data,
+ ...body,
tagsToId,
bitlyApiKey,
});