Devben
CCConvex Community
•Created by Devben on 8/12/2024 in #support-community
convex auth: Unable to decode ID: Invalid ID length 5
I'm trying to get the current user but it's returning undefine am using nextjs and i follow the nextjs step, but when i change the convexnextjsauthprovide to authprovider i see the user however am seeing this error.
if (userId === null || userId.length < 5) { console.log("Invalid user ID"); return null; } return await ctx.db.get(userId); }, }); @erquhart bro check this out.
Uncaught (in promise) Error: [Request ID: 5dfe7ffe2f531b80] Server Error
Uncaught Error: Uncaught Error: Invalid argument
id for
db.get: Unable to decode ID: Invalid ID length 5
my current user function
import { query } from "./_generated/server";
import { auth } from "./auth";
export const currentUser = query({
args: {},
handler: async (ctx) => {
const userId = await auth.getUserId(ctx);
if (userId === null || userId.length < 5) { console.log("Invalid user ID"); return null; } return await ctx.db.get(userId); }, }); @erquhart bro check this out.
34 replies
CCConvex Community
•Created by Devben on 3/18/2024 in #show-and-tell
DevIdeal: Post and find project Ideal
3 replies
CCConvex Community
•Created by Devben on 3/17/2024 in #support-community
User imageURL not working
After successful clerk integration with convex.... I can see the username and fullname and other properties but the imagerURL property is not working.
6 replies
CCConvex Community
•Created by Devben on 3/17/2024 in #support-community
useQuery throwing errors
Argument of type 'FunctionReference<"mutation", "public", { bio: string; stack: string; links: string; }, null>' is not assignable to parameter of type 'FunctionReference<"query">'.
Type '"mutation"' is not assignable to type '"query"'.
11 replies
CCConvex Community
•Created by Devben on 3/14/2024 in #support-community
Help using convex with clerk
Note: am new to convex.
I follow the document on how to use clerk with convex I successfully see the user info in clerk but not in convex and I even try to debug using clerk debug method still not working despite the fact that I connect my front with convex using npx convex dev.
92 replies
CCConvex Community
•Created by Devben on 3/12/2024 in #support-community
Despite the fact that I wrap convexProvide in my layout page still seeing an error which says:
ERROR:
⨯ node_modules\convex\dist\esm\react\client.js (318:10) @ useMutation
⨯ Error: Could not find Convex client!
<Toaster /> </div> </body> </html> </ClerkProvider> ); } database setup: import { mutation, query } from "./_generated/server"; import { v } from "convex/values"; export const SubmitIdeals = mutation({ args:{ title:v.string(), plang:v.string(), level:v.string(), description:v.string(), }, handler: async (ctx, args) =>{ const {title, plang, level, description} = args; await ctx.db.insert("ideal",{ title, plang, level, description }); } }) frontend use: const SubmitIdeals = useMutation(api.ideal.SubmitIdeals); and before I even running it, it's already give me an hint saying Ideals is not defing in api
useMutation
must be used in the React component tree under ConvexProvider
. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app
at Submit (./components/submitIdeal.tsx:34:83)
Although this is my first time using convex am learning through their docs thanks.
more code to help
Layout.tsx:
import type { Metadata } from "next";
import { Poppins } from "next/font/google";
import "../styles/globals.css";
import Navbar from "@/components/navbar";
import { ClerkProvider } from "@clerk/nextjs";
import { Toaster } from "sonner";
import ConvexClientProvider from "./ConvexClientProvider";
return (
<ClerkProvider>
<html lang="en">
<body className={${poppins.className} wind
}>
<div>
<Navbar />
<ConvexClientProvider>{children}</ConvexClientProvider>
{auth}<Toaster /> </div> </body> </html> </ClerkProvider> ); } database setup: import { mutation, query } from "./_generated/server"; import { v } from "convex/values"; export const SubmitIdeals = mutation({ args:{ title:v.string(), plang:v.string(), level:v.string(), description:v.string(), }, handler: async (ctx, args) =>{ const {title, plang, level, description} = args; await ctx.db.insert("ideal",{ title, plang, level, description }); } }) frontend use: const SubmitIdeals = useMutation(api.ideal.SubmitIdeals); and before I even running it, it's already give me an hint saying Ideals is not defing in api
28 replies