Next.js Discord

Discord Forum

Incorrect stack trace line number on both frontend and backend

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hey all,

I understand its TS and it goes through transpilation and minifications etc., but there is no way I cannot send the line where an error occured to my logging service. It gives me the wrong line number and it really gives a hard time to the developers. Is there any way to fix this?

9 Replies

American black bearOP
?
It’s feasible but tricky
There’s no real docs on it
Sentry is a logging service which has accurate traces with correct line numbers.
You can try using them
However if you want the actual code
I would look up sentry’s nextjs plugin on GitHub
And then try to find the relevant sourcemap configs in their webpack plugin
Source maps is the keyword you’re looking for here