Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 error codes on 404 #134

Closed
dnlup opened this issue Mar 7, 2022 · 3 comments
Closed

500 error codes on 404 #134

dnlup opened this issue Mar 7, 2022 · 3 comments
Assignees
Labels

Comments

@dnlup
Copy link
Contributor

dnlup commented Mar 7, 2022

A 404 generates an internal server error because the plugin tries to send a metric using the reply decorator, which in turn checks for the presence of a routeId inside the metrics object. This object is not setup for a route that doesn't exists because we use the onRoute hook to do it. We should take this into account in the onError hook.

@dnlup dnlup added bug Something isn't working released on @next labels Mar 7, 2022
@dnlup dnlup added this to the 🔥 Version 2 milestone Mar 7, 2022
@dnlup dnlup self-assigned this Mar 7, 2022
@dnlup
Copy link
Contributor Author

dnlup commented Mar 7, 2022

While I am working on it, I see that every hook has this problem, not just the onError one. So I think we should move the check inside the decorators.

@antoniomuso
Copy link
Contributor

I think we can check in both cases.

@dnlup dnlup mentioned this issue Mar 7, 2022
5 tasks
simonecorsi pushed a commit that referenced this issue Mar 10, 2022
# [2.0.0](v1.0.0...v2.0.0) (2022-03-10)

### Bug Fixes

* **types:** add missing types ([74444b9](74444b9))
* check for the presence of metrics object ([288771b](288771b)), closes [#134](#134)
* **label:** label with undefined id ([6d79705](6d79705))
* fix isCustomClientCheck ([ff5ffe9](ff5ffe9))
* remove doc decorator ([50abf07](50abf07))
* upgrade fastify-plugin from 3.0.0 to 3.0.1 ([2a04a38](2a04a38))
* **dynamic mode:** fixed this context in getLabel for dynamic mode to be the request context ([0dac171](0dac171))
* **TCP:** fixed tcp ([58690d2](58690d2))
* **types:** added missing type for FastifyContextConfig ([fa07110](fa07110))
* **types:** fix wrong export name ([119fdc3](119fdc3))

### chore

* **deps:** update dats to version 2 ([03d2316](03d2316))

### Features

* add boolean to routes config ([acca747](acca747))
* rename routes.timing in responseTime ([44fe70a](44fe70a))
* **metric:** add req/res size metric ([1f7b2a4](1f7b2a4)), closes [#32](#32)
* added skip for empty ids ([cbee46b](cbee46b))
* allow custom Dats client ([40de470](40de470))
* change configuration object ([df6ba44](df6ba44))
* decorated request and reply with get label function ([f00b9d5](f00b9d5))
* scope instance decorators ([d1331a1](d1331a1))
* **routes:** add normalized strings to context ([4b172d6](4b172d6))
* custom route metric label ([efe0131](efe0131))
* expose process metrics sampler ([67b69c5](67b69c5))
* prerelase ([2d0d1d0](2d0d1d0))

### BREAKING CHANGES

* timing is renamed to responseTime.
* The previous configuration is not supported anymore,
please check your client, routes and health configurations.
* the fastify instance decorators are exported in the `metrics` object.
The `doc` sampler instance is renamed to `sampler`.
* **deps:** there might be breaking changes in the new dats version.
* the routes metrics options have changed.
The default route prefix is now an empty string and not 'api'.
The dats instance is exported as `metricsCLient`.
* **types:** the plugin init functions have different names.
@simonecorsi
Copy link
Collaborator

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants