Magnus Müller
Magnus Müller4mo ago

convex-auth template error getAuthUserId

When I install the Convex Auth template https://www.convex.dev/templates/convex-auth with npm create convex -- -t get-convex/convex-auth-example, follow the setup and then do npx convex dev I get the error:
convex/messages.ts:1:10 - error TS2305: Module '"@convex-dev/auth/server"' has no exported member 'getAuthUserId'.

1 import { getAuthUserId } from "@convex-dev/auth/server";
~~~~~~~~~~~~~
convex/users.ts:2:10 - error TS2305: Module '"@convex-dev/auth/server"' has no exported member 'getAuthUserId'.

2 import { getAuthUserId } from "@convex-dev/auth/server";
convex/messages.ts:1:10 - error TS2305: Module '"@convex-dev/auth/server"' has no exported member 'getAuthUserId'.

1 import { getAuthUserId } from "@convex-dev/auth/server";
~~~~~~~~~~~~~
convex/users.ts:2:10 - error TS2305: Module '"@convex-dev/auth/server"' has no exported member 'getAuthUserId'.

2 import { getAuthUserId } from "@convex-dev/auth/server";
Convex Auth
Convex Auth is a library for implementing authentication directly within your Convex backend. This allows you to authenticate users without needing an authentication service or even a hosting server. Your application can be a React web app served from a CDN or a React Native mobile app.
3 Replies
sshader
sshader4mo ago
Sounds like we have some version mismatches -- thanks for pointing it out. Can you try npm install @convex-dev/auth@latest?
Magnus Müller
Magnus MüllerOP4mo ago
I changed getAuthUserIdto ctx.auth.getUserIdentity(); this works
Magnus Müller
Magnus MüllerOP4mo ago
I am also little bit confused, because here https://www.convex.dev/templates/convex-auth you say its next.js but when i run the template it uses vite
Convex Auth
Convex Auth is a library for implementing authentication directly within your Convex backend. This allows you to authenticate users without needing an authentication service or even a hosting server. Your application can be a React web app served from a CDN or a React Native mobile app.

Did you find this page helpful?