lnajim
lnajim•4mo ago

Convex Auth: Cannot read properties of undefined (reading 'length')

Hey all, does any one know how to fix that error
No description
15 Replies
ballingt
ballingt•4mo ago
What version of Convex Auth is this @Indrajit?
lnajim
lnajimOP•4mo ago
Hi @Tom "@convex-dev/auth": "^0.0.77", that my versin
ballingt
ballingt•4mo ago
What version do you have installed? You can check with npm ls @convex-dev/auth That's the version spec from your package.json which says what versions are allowed, but doesn't tell us what version you're actually using.
lnajim
lnajimOP•4mo ago
"@convex-dev/auth@^0.0.77": version "0.0.77" resolved "https://registry.yarnpkg.com/@convex-dev/auth/-/auth-0.0.77.tgz#8291440ab1cb7ef54a4191dbe378ed0bb0ab18d3" integrity sha512-+xi4D2CvKmXucqirv8gMmYkUA996R/MtdVZ4Da8HmkY3rzUo/JkkI8bfigwgO3OpCEV4xk7iGFDxGOUIbFEkww== dependencies: arctic "^1.2.0" cookie "^1.0.1" jose "^5.2.2" jwt-decode "^4.0.0" lucia "^3.2.0" oauth4webapi "^3.1.2" oslo "^1.1.2" path-to-regexp "^6.3.0" server-only "^0.0.1"
ballingt
ballingt•4mo ago
Could you try upgrading first? to the latest version, you could use npm i @convex-dev/auth@latest Then even if you have the same error, it'll be easier to use the line number to figure out what's wrong
lnajim
lnajimOP•4mo ago
but I think I made a mistake when I implement the provide into my layout in mix up the react documenation and the nextjs that why I use the ConvexClientProivder from react for my next js project now I remove it and put the correct one I dont have it anymore 🙂
ballingt
ballingt•4mo ago
nice!
lnajim
lnajimOP•4mo ago
thx you for your quick help
ballingt
ballingt•4mo ago
Maybe we can show a better error there, so the problem was that it wasn't the COnvx Auth provider? Cool, I'll just make that error a little nicer
lnajim
lnajimOP•4mo ago
I use that code
"use client";

import { ConvexReactClient } from "convex/react";
import { ConvexAuthProvider } from "@convex-dev/auth/react";
const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);

export default function ConvexClientProvider({
children,
}: {
children: React.ReactNode;
}) {
return (
<ConvexAuthProvider client={convex}>
{children}
</ConvexAuthProvider>
);
}
"use client";

import { ConvexReactClient } from "convex/react";
import { ConvexAuthProvider } from "@convex-dev/auth/react";
const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);

export default function ConvexClientProvider({
children,
}: {
children: React.ReactNode;
}) {
return (
<ConvexAuthProvider client={convex}>
{children}
</ConvexAuthProvider>
);
}
. instead of that one
"use client";

import { ConvexAuthNextjsProvider } from "@convex-dev/auth/nextjs";
import { ConvexReactClient } from "convex/react";
import { ReactNode } from "react";

const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);

export function ConvexClientProvider({ children }: { children: ReactNode }) {
return (
<ConvexAuthNextjsProvider client={convex}>
{children}
</ConvexAuthNextjsProvider>
);
}
"use client";

import { ConvexAuthNextjsProvider } from "@convex-dev/auth/nextjs";
import { ConvexReactClient } from "convex/react";
import { ReactNode } from "react";

const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);

export function ConvexClientProvider({ children }: { children: ReactNode }) {
return (
<ConvexAuthNextjsProvider client={convex}>
{children}
</ConvexAuthNextjsProvider>
);
}
ballingt
ballingt•4mo ago
Cool, I just improved the refresh token parsing error https://github.com/get-convex/convex-auth/commit/db75765df15103d474b71b35cb8f91ab800e72e4 for now
lnajim
lnajimOP•4mo ago
thx, may I ask you another question ?
ballingt
ballingt•4mo ago
Sure, but could you open a community support thread? easier to find later
lnajim
lnajimOP•4mo ago
ok
ballingt
ballingt•4mo ago
No description

Did you find this page helpful?