nitrojs / nitrojs/nitro

Log route for exceptions

Open
#1,736 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

dx enhancement v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Describe the feature

I am currently using Nuxt to write an application. As it is almost impossible to check for every eventuality during development there are sometimes exception logged on production. However, as everything is bundled, the stack traces are not really useful and do not give any hint as to which route was causing the problem.

In those cases it would greatly simplify troubleshooting if some information about the request is also logged for exceptions.

In some cases it is possible to find the handler file ( ./.output/server/chunks/foobar.get.mjs) listed as part of the stack trace though that is not always the case. For example I have to error messages [nuxt] [request error] [unhandled] [500] The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of URLSearchParams and [nuxt] [request error] [unhandled] [500] Cannot set headers after they are sent to the client where I do not know from which handler they originate. Therefore I am also not sure if this might be my fault or something within Nuxt which is failing - and I have no good way to create a reproducible example to figure that out and maybe raise a proper issue here.

Additional information
  • Would you be willing to help implement this feature?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue identifies production request exceptions and generated handler paths such as ./.output/server/chunks/foobar.get.mjs. Start by locating Nitro’s request-error logging path and determine how the originating route can be retained; done means exception logs identify the request route without relying on bundled stack traces, including the two reported error forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
backend, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.