Skip to content

Commit 7d03ee6

Browse files
committed
coderabbit changes
1 parent 634a9a7 commit 7d03ee6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/guides/frameworks/nango.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ sequenceDiagram
7474
export async function POST(req: Request) {
7575
const { userId } = await req.json();
7676

77+
if (!userId || typeof userId !== "string") {
78+
return NextResponse.json({ error: "Missing or invalid userId" }, { status: 400 });
79+
}
80+
7781
const response = await fetch("https://api.nango.dev/connect/sessions", {
7882
method: "POST",
7983
headers: {
@@ -114,7 +118,8 @@ sequenceDiagram
114118
const { token } = await sessionRes.json();
115119

116120
const nango = new Nango({ connectSessionToken: token });
117-
const result = await nango.auth("github");
121+
// Use the exact integration slug from your Nango dashboard
122+
const result = await nango.auth("<your-integration-slug>");
118123

119124
// result.connectionId is what you pass to your task
120125
await fetch("/api/analyze-prs", {
@@ -222,7 +227,6 @@ export const analyzePRs = task({
222227
Add a route handler that receives the `connectionId` from your frontend and triggers the task:
223228

224229
```ts app/api/analyze-prs/route.ts
225-
import { tasks } from "@trigger.dev/sdk";
226230
import { analyzePRs } from "@/trigger/analyze-prs";
227231
import { NextResponse } from "next/server";
228232

@@ -233,10 +237,7 @@ export async function POST(req: Request) {
233237
return NextResponse.json({ error: "Missing connectionId or repo" }, { status: 400 });
234238
}
235239

236-
const handle = await tasks.trigger<typeof analyzePRs>("analyze-prs", {
237-
connectionId,
238-
repo,
239-
});
240+
const handle = await analyzePRs.trigger({ connectionId, repo });
240241

241242
return NextResponse.json(handle);
242243
}

0 commit comments

Comments
 (0)