Augmenting default user in next auth
Ive changed the default parameters for a user in next auth to also include user name so that when I get my session I can access "sessionData.user?.username?". This all worked locally until I decided to deploy to vercel. The following shows my screenshots and the error I got in vercel. Any ideas on how to work around this?
2 Replies
Did you edit the types files in next-auth inside the node_modules? This is not going to work. Vercel and any other platform will do „npm install“ or whatever package manager you are using and will get a clean version of the package. Your edit does only effect your local environment
You are looking for this https://next-auth.js.org/getting-started/typescript#module-augmentation
TypeScript | NextAuth.js
NextAuth.js has its own type definitions to use in your TypeScript projects safely. Even if you don't use TypeScript, IDEs like VSCode will pick this up to provide you with a better developer experience. While you are typing, you will get suggestions about what certain objects/functions look like, and sometimes links to documentation, examples, ...