Type Promise not asignable to type Awaitable
What am I doing wrong here and how can I fix it?
![](https://utfs.io/f/bd8bc156-7779-45eb-bfb9-9f008102b89a-1nq2cb.png)
6 Replies
Can you give some more context
Sure, this is not really an error, the function works just fine but vscode is screaming at me. The db is in mysql, this query just looks for the user using the email and stores it in the next-auth session which uses jwt strategy and a credentials provider. logging the user returns the user correctly and if it doesn't find it, it ends up beign null but for some reason whenever I try to write a return user, it gives me that vscode error. As far as I know prisma.findUnique returns a js object after the promise resolves or null if it doesn't find it. It stops screaming at me if I return a hardcoded object. My guess is that maybe authorize expects an Awaitable object instead of just a promise? I wouldn't know how to debug it either since ts is pretty new for me and I'm a bit lost. Also the project is built with t3 app and it's like the first thing that I'm doing on it so there's like nothing else in the app.
Can you scroll further down on the error message?
@Alejo
![](https://utfs.io/f/6b9f41cf-2495-489e-8928-7f038eb471ed-1nq2cb.png)
Hm, at a glance it would seem that name in the prisma schema is nullable, whereas the function expects the return type of the function to be
but your function is returning
You'd need to either provide a default value to
user.name
before returning it and making sure Typescript understands that that value is not null, you can do that by doing something like
Alternatively the other option is modifying your prisma schema to make name
a required field for usersI get it now, thanks!