I’m getting the same error but its weird.
This is my protected middleware and trust me I’m importing it carefully. I’m getting the token and as well as req.user in my console.
The problem comes here in the controller part. When I tried to only run the commented part it showed a 400 bad request. So I had to just a res.json(req.user) which seemed to work fine. I don’t know the issue. The database is working.
I have spent few days but couldn’t found a solution.