Feature(s) impacted
According to routes documentation: The generated routes use next()
to call Forest Admin’s default behavior.
We used this implementation in our codebase:
// Get a number of Customers
router.get('/customers/count', permissionMiddlewareCreator.list(), async (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#get-a-number-of-records
next();
});
Observed behavior
When an error occurs in this endpoint, we can’t catch it with an error middleware.
It seems like the default route is not well implemented in the method next()
.
When I copy and paste the snippets code of default routes, the routes work and we can handle the errors in a middleware.
Expected behavior
Handle default routes errors in a middleware without overriding.
Failure Logs
[forest] 🌳🌳🌳 Unexpected error: function lower(uuid) does not exist
{
"name": "SequelizeDatabaseError",
"parent": {
"length": 205,
"name": "error",
"severity": "ERROR",
"code": "42883",
"hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
"position": "165",
"file": "parse_func.c",
"line": "528",
"routine": "ParseFuncOrColumn",
"sql": "SELECT count(\"customers\".\"id\") AS ...;"
},
"original": {
"length": 205,
"name": "error",
"severity": "ERROR",
"code": "42883",
"hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
"position": "165",
"file": "parse_func.c",
"line": "528",
"routine": "ParseFuncOrColumn",
"sql": "SELECT count(\"customers\".\"id\") AS ...;"
},
"sql": "SELECT ...;",
"stack": "SequelizeDatabaseError: function lower(uuid) does not exist\n at Query.formatError (...)"
}
Context
Please provide in this mandatory section, the relevant information about your configuration:
- Project name: Koala
- Team name: Operations
- Environment name: all