-
Notifications
You must be signed in to change notification settings - Fork 2
Better serve logging #50
Comments
There's some pretty bad logging duplication/weirdness going on. Reproduction: Have a single config with these fields:
Make a request and wait for almost a dozen confusing logs. That's because 3 endpoints get registered with express, all with the same /api/resource endpoint. There needs to be some kind of endpoint grouping. Like, maybe all of this should fit into one snug config where the endpoint is /api/resource and that config could have multiple query configurations. Possible ServerConfig: // ...
request: {
endpoint: '/api/resource',
queryConfigurations: [{ sort: 'asc' }, { sort: 'desc' }, {}],
},
// ... That'd work pretty well seeing that for each individual raw config, the only thing that can possibly differ are the base endpoint and the query. Everything else stays exactly the same. Here's another case I can write a test for: Have a single config with these fields:
Maybe in serve mode, the endpoints should just be ignored completely if serveEndpoint is given? Not sure. I think I need to test the above case and actually check if express will try to trigger that route 3 times even though it should already be satisfied once. |
Oh so the problem is that I actually just missed a return statement after the query check validation. Whoops! That's why it seemed like took many routes were triggering. That, and I'm sleepy |
I forgot to return after doing the query validation, so even if the query was found to be invalid it would still continue trying to serve the request using the same handler re #50
I forgot to return after doing the query validation, so even if the query was found to be invalid it would still continue trying to serve the request using the same handler re #50
I forgot to return after doing the query validation, so even if the query was found to be invalid it would still continue trying to serve the request using the same handler re #50
These warnings aren't particularly helpful if there are multiple query configurations: 2020-04-26 23:42:35 - warn: An endpoint for /api/route exists but the query params did not match the configuration
Possible message: warn: An endpoint for /api/route exists but the query params did not match any of the given configurations
|
|
serverLogger.warn(
`An endpoint for ${req.path} exists but the request body did not match the type`,
{ problems: validationResult },
) |
|
It used to spit out quite a lot. Not sure what the state of it is nowadays.
The text was updated successfully, but these errors were encountered: