214 viewsNext Amazona

Hi Basir,

Thank you for posting the great videos on Youtube!

I am flowing the Next.js project https://www.youtube.com/watch?v=zWEvbGdUhRg&t=10505s

After the ‘place order’ section I was not able to place an order, and the error was ‘Order validation failed: user: Path `user` is required.’

I think the user was not passed to the POST function in app/api/orders/route.ts

When I log the req.auth in const POST = auth(async (req: any), it was something like { user: {}, expires: ‘2024-03-05T00:59:01.301Z’ }.

I double checked the code and looks exactly the same as your public repo.

Would you please advise what might be wrong with that?

Thank you!

Bassir Answered question February 5, 2024

the issue is not in passing payload for the api request. req.auth is filled by next auth. check your code with mine in this file:
https://github.com/basir/next-amazona-v2/blob/main/lib/auth.ts

Bassir Answered question February 5, 2024
You are viewing 1 out of 1 answers, click here to view all answers.