Repository navigation
fix(nitro): skip default error logging when evlog records the request - #837
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
@evlog/cli
evlog
@evlog/nuxthub
@evlog/signals
@evlog/telemetry
commit: |
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (6)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Follow-up to #819. Found while testing the release candidate in a Nuxt app.
📚 Description
#819 stopped Nitro from printing expected evlog 4xx errors, but kept its default logging for everything else. In production, an unhandled crash or a
fatalh3 error still printed twice: once as the wide event, and once as Nitro's[request error] [unhandled]block with the full stack and the h3 error object.Change
evlog's error handler only calls
ctx.defaultHandler(..., { silent: false })to get that log, since it writes the response itself. It now skips the call whenever the evlog plugin records the request (_evlogShouldEmit, set in therequesthook), for both Nitro v2 and v3. Nitro still logs the error when evlog is disabled, the route is excluded withinclude/exclude, or the plugin is not registered, so an error is never silent.The check uses
_evlogShouldEmitand not_evlogEmitted: Nitro v2 doesn't await theerrorhook before running the error handler, so the emitted flag isn't set yet at that point.Not covered: Nuxt's own error handler calls
defaultHandlerwithsilent: falsefor HTML page requests, which evlog's handler passes on to it. So an SSR page crash still prints Nitro's block.Tests
TypeErrorand afatal503 on a recorded request don't calldefaultHandler. An excluded route still does.evlogsuite passes (2,121 tests), along with build and lint./api/crashand/api/upstreamprint only their wide event.📝 Checklist
Summary by CodeRabbit