You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The terminal console shows stack traces with invalid / low-value line numbers. For example:
Error: line2
at handler (webpack-internal:///./pages/api/hello.js:4:9)
at apiResolver (/home/jasonnet/jack_work/nextjs-blog/node_modules/next/dist/next-server/server/api-utils.js:8:7)
at process._tickCallback (internal/process/next_tick.js:68:7)
where the line number of the problem in pages/api/hello.js is not 4.
Expected Behavior
One of the following:
Display line numbers in the original source code
Provide a mechanism for a developer to convert these webpack-internal line numbers to original source code line numbers
Pprovide a way to turn off the (?server-side ?webpack?) feature that contributes to this problem
or provide enough education here that an noob outside developer could generate a pull request implementing one of these solutions.
To Reproduce
Start with the create-next-app tutorial code found here. Then modify that handler function ./pages/api/hello.js to throw an Error:
export default function handler(req, res) {
throw new Error("line2");
res.status(200).json({ text: 'Hello' })
}
Error: line2
at handler (webpack-internal:///./pages/api/hello.js:4:9)
at apiResolver (/home/jasonnet/jack_work/nextjs-blog/node_modules/next/dist/next-server/server/api-utils.js:8:7)
at process._tickCallback (internal/process/next_tick.js:68:7)
As you can see the line number is listed as 4 rather than 2. If you try to reproduce this and see a correct value ("2"), then update the hello.js to include an import at the top, which should cause the stack trace line number to no longer match hello.js file even if it matched earlier.
What is the process to convert these webpack-internal line numbers to line numbers in the original source files? Is there a process to avoid these webpack-internal line numbers altogether?
The text was updated successfully, but these errors were encountered:
@timneutkens I see the commit. Thanks for your effort on this. That is helpful.
For those of use wanting to see the actual stack trace instead of the pretty-printed line of source code, is there a new API available to us to determine the line number and file for each stack frame in the stack trace? Perhaps createOriginalStackFrame and the callers of that function?
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 27, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Next.js are you using?
10.x, 11.0
What version of Node.js are you using?
14.17
What browser are you using?
N/A
What operating system are you using?
Linux, MacOS
How are you deploying your application?
npm run dev
Describe the Bug
The terminal console shows stack traces with invalid / low-value line numbers. For example:
where the line number of the problem in pages/api/hello.js is not 4.
Expected Behavior
One of the following:
Display line numbers in the original source code
Provide a mechanism for a developer to convert these webpack-internal line numbers to original source code line numbers
Pprovide a way to turn off the (?server-side ?webpack?) feature that contributes to this problem
or provide enough education here that an noob outside developer could generate a pull request implementing one of these solutions.
To Reproduce
Start with the create-next-app tutorial code found here. Then modify that handler function ./pages/api/hello.js to throw an Error:
Then run
npm run dev
If one then visits http://localhost:3000/api/hello one sees something like:
As you can see the line number is listed as 4 rather than 2. If you try to reproduce this and see a correct value ("2"), then update the hello.js to include an import at the top, which should cause the stack trace line number to no longer match hello.js file even if it matched earlier.
What is the process to convert these webpack-internal line numbers to line numbers in the original source files? Is there a process to avoid these webpack-internal line numbers altogether?
The text was updated successfully, but these errors were encountered: