Next.js Discord

Discord Forum

Weird error with Neon and Drizzle

Unanswered
Vespid wasp posted this in #help-forum
Open in Discord
Avatar
Vespid waspOP
export default function ProfileForm() {

    // 1. Define your form.
    const form = useForm<z.infer<typeof formSchema>>({
        resolver: zodResolver(formSchema),
        defaultValues: {
            title: "",
            content: "",
            category: "",
        },
    });

    // Move useAuth to the top level
    const authObj = useAuth();
    const clerkID = authObj.userId as string;

    // 2. Define a submit handler.
    async function onSubmit(values: z.infer<typeof formSchema>) {
        console.log(clerkID);
        // const user = await getUser(clerkID);

        // const username = user.username;
        // const userID = user.user_id;
        // const firstName = user.first_name;
        // const lastName = user.last_name;
        // const fullName = `${firstName} ${lastName}`;

        const title = values.title;
        const content = values.content;
        const category = values.category;

        console.log(title, content, category);

        try {
            const result = await createPost(title, content, category, clerkID);
            console.log(result);
        } catch (error) {
            console.error(error);
        }
    }


I'm trying to make a blog website as my first "full-stack" application. I've copied over shadcn's form. I have a getUser function that takes in a clerk_id and returns the user object. Right now, if I un-comment the line: const user = await getUser(clerkID);, I get a weird error:
TypeError: client is not a function
    at NeonHttpPreparedQuery.execute (session.ts:52:24)
    at insert.ts:332:27
    at Object.startActiveSpan (tracing.ts:27:11)
    at QueryPromise.execute (insert.ts:331:17)
    at QueryPromise.then (query-promise.ts:31:15)

Can anyone help me out?

0 Replies