codebirdC
Convex Community13mo ago
15 replies
codebird

Convex Auth error with Nextjs 15

Just upgraded the Convex v1 starter kit to "next": "15.1.3" ( "@auth/core": "^0.37.4") and it showed the following error-

Unhandled Runtime Error

[ Server ] Error: {"code":"InvalidAuthHeader","message":"Could not parse as id token"}

async Layout
./src/app/%5Blocale%5D/(dashboard)/layout.tsx

Made a couple of changes, but still the error persists-
1. Added await in the layout file- token: await convexAuthNextjsToken(), similarly in middleware file- https://github.com/get-convex/v1/blob/main/apps/app/src/app/%5Blocale%5D/(dashboard)/layout.tsx
2. Added a new isAuthenticated endpoint to the list of exported Convex functions, like

export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth(... as described here https://github.com/get-convex/convex-auth/blob/main/CHANGELOG.md

What else can be done?
GitHub
An open-source starter kit based on Midday. Ported to Convex. - get-convex/v1
v1/apps/app/src/app/[locale]/(dashboard)/layout.tsx at main · get-c...
GitHub
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
convex-auth/CHANGELOG.md at main · get-convex/convex-auth
Was this page helpful?