question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Report path to show in error messages

See original GitHub issue

Feature request

Is your feature request related to a problem? Please describe.

When you miss an import directly or through a sub-modules in a next api route, ti does not report actual error.

In my case i get

{ Error: Cannot find module for page: /api/v1/contacts/
    at pageNotFoundError (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/require.js:8:17)
    at Object.getPagePath (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/require.js:27:19)
    at DevServer.getPagePath (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/next-server.js:418:26)
    at DevServer.handleApiRequest (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/next-server.js:459:42) code: 'ENOENT' }
{ Error: Cannot find module for page: /api/v1/contacts/
    at pageNotFoundError (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/require.js:8:17)
    at Object.getPagePath (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/require.js:27:19)
    at DevServer.getPagePath (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/next-server.js:418:26)
    at DevServer.handleApiRequest (/home/.../workspace/node/.../.../node_modules/next/dist/next-server/server/next-server.js:459:42) code: 'ENOENT' }

I have not idea where the issue is. Notice ive used ... to anonymise the path

Describe the solution you’d like

Error message should include path of module file I tried to import

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aberbacommented, Jul 19, 2020

Its a hard to track error. Happens quite often with api routes in my case. Hard to track especially when you have lots of code. I suspect its a recursive import issue.

@dvakatsiienko Check this are you using require() and import mixed up?

0reactions
github-actions[bot]commented, Dec 1, 2022

Please verify that your issue can be recreated with next@canary.

Why was this issue marked with the please verify canary label?

We noticed the provided reproduction was using an older version of Next.js, instead of canary.

The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. You can think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running npm install next@canary and test it in your project, using your reproduction steps.

If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.

How can I quickly verify if my issue has been fixed in canary?

The safest way is to install next@canary in your project and test it, but you can also search through closed Next.js issues for duplicates or check the Next.js releases.

My issue has been open for a long time, why do I need to verify canary now?

Next.js does not backport bug fixes to older versions of Next.js. Instead, we are trying to introduce only a minimal amount of breaking changes between major releases.

What happens if I don’t verify against the canary version of Next.js?

An issue with the please verify canary that receives no meaningful activity (e.g. new comments that acknowledge verification against canary) will be automatically closed and locked after 30 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue, with the required reproduction, using next@canary.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the 👍 reaction on the topmost comment (please do not comment “I have the same issue” without repro steps). Then, we can sort issues by votes to prioritize.

I think my reproduction is good enough, why aren’t you looking into it quicker?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Messages: Examples, Best Practices & Common Mistakes
Useful error messages can keep users on your site and increase conversions. See examples and learn the best practices.
Read more >
Display All PHP Errors: Basic & Advanced Usage
Being able to see what went wrong is vital during troubleshooting. Learn how to enable all PHP errors and warnings in your app....
Read more >
Information disclosure in error messages not a weakness ...
Drupal core provides a feature to show error messages to site visitors ... messages not a weakness (Path disclosure, SQL error messages, etc ......
Read more >
Other Examples of Error Handling in Flows - Salesforce Help
If the flow is used only internally, such as at a call center, use the fault path to display the error message to...
Read more >
How do I get PHP errors to display? - Stack Overflow
You can show Php error in your display via simple ways. Firstly, just put this below code in your php ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found