I am facing this issue, that I have a route in exp...
# orm-help
s
I am facing this issue, that I have a route in express at which prisma throws this error, but even if I remove the route it just throws this particular error, it doesn't matter if I rewrite the controller of that particular route it just throws this error which is pretty invalid that I am passing a Float and expected is Int I have no idea what the error is saying, HELP
r
Could you share a basic repo that I can check?
s
every thing was working fine, today I just say that this was happening
r
On what route does this error occur?
I would like to know what are data you passing and what goes in the request.
s
/api/v1/user/authuser
is the route
and this route just takes the Authorization header which has jwt and I have a middleware to get id of the User and attach that to Request object of express and in side the route I just query the user with prisma.user.findUnique() and return the user
r
What is the output of
req.user
when you log it here?
s
that is the problem it is not at all entering the route
it just throws that same error even if I remove the route, reinstall my packages, shut my pc off and on again it doesn't matter, error remains constant
if I create a new project and copy and paste files and do evert thing first start again with, I even changed the database but things just work the same way, I get that error what so ever
but every other route works perfectly fine
r
The order of your routes was incorrect. It should be:
Copy code
router.get('/authuser', auth, ash(getAuthUserInfo))
router.get('/:userId', ash(getUserInfo))
Express matches the first route it gets. So specific routes need to come first.
s
so since the /:userId route is first in my code it things that /authuser is not a route rather it is a param value of userId='authuser' and hence error, Am I right
✅ 1
Thank you so much
🙌 1