Moha
Moha2y ago

No autocompletion for HTTP client

import { NextResponse } from "next/server";
import { ConvexHttpClient } from "convex/browser";
import { api } from "@/convex/_generated/api";

const client = new ConvexHttpClient(process.env.CONVEX_URL!);

export async function POST(req: Request) {
const body = await req.json();
await client.mutation(api.profiles.create, {
userId: body.data.id,
name,
email: body.data.email_addresses[0].email_address,
avatarUrl: body.data.profile_image_url,
});
}
import { NextResponse } from "next/server";
import { ConvexHttpClient } from "convex/browser";
import { api } from "@/convex/_generated/api";

const client = new ConvexHttpClient(process.env.CONVEX_URL!);

export async function POST(req: Request) {
const body = await req.json();
await client.mutation(api.profiles.create, {
userId: body.data.id,
name,
email: body.data.email_addresses[0].email_address,
avatarUrl: body.data.profile_image_url,
});
}
I have a problem the using this convex http client on the server on NextJs 13, I'm not getting any intellisense on the api. it's not working!
1 Reply
ballingt
ballingt2y ago
Does it change at all if you use a relative import for api instead of the @/convex/_generated/api? does hovering over api show anything, is that type understood by the editor? Are you using TypeScript in this project? @Mohamed EL GUARIR

Did you find this page helpful?