You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When making a request in Postman with an incorrectly written route, the system returns a 401 Unauthorized error instead of an appropriate error indicating that the route is not found. The 401 error suggests an authentication issue, which is misleading when the actual issue is a miswritten route.
Steps to reproduce
Open Postman.
Enter an invalid or incorrectly written route in the request URL field (e.g., /signup).
2. The correct one is /sign-up
Set the request method to the appropriate type (GET, POST, etc.) in this case is POST.
Send the request.
What was the actual result?
401:
{
"errorType": "COMMON",
"message": "Token is no longer valid. Please log in again."
}
What was the expected result?
The server should return a 404 Not Found error indicating that the route is not available or incorrectly specified.
Put here any screenshots or videos (optional)
What OS are you seeing the problem on?
Other (mention in the description)
What browsers are you seeing the problem on?
Other (mention in the description)
Severity
Trivial (S5)
The text was updated successfully, but these errors were encountered:
This behavior occurs due to how Fastify validates requests. It first performs all validations (including token validation) before checking if the route exists. Since the token validation throws an error first, we get that error instead of the 404, which is handled by the setNotFoundHandler method.
The approach implemented was to retrieve all system routes, and if the route being accessed is not in the system or the whitelist, let the setNotFoundHandler handle it.
But to use printRoutes it need to be inside or after a this.app.ready(), but when trying to implement this other method we get the error "Root plugin has already booted".
Describe your issue
When making a request in Postman with an incorrectly written route, the system returns a 401 Unauthorized error instead of an appropriate error indicating that the route is not found. The 401 error suggests an authentication issue, which is misleading when the actual issue is a miswritten route.
Steps to reproduce
2. The correct one is /sign-up
What was the actual result?
401:
{
"errorType": "COMMON",
"message": "Token is no longer valid. Please log in again."
}
What was the expected result?
The server should return a 404 Not Found error indicating that the route is not available or incorrectly specified.
Put here any screenshots or videos (optional)
What OS are you seeing the problem on?
Other (mention in the description)
What browsers are you seeing the problem on?
Other (mention in the description)
Severity
Trivial (S5)
The text was updated successfully, but these errors were encountered: