API(8.1.1-canary.28): error logged when importing child_process
See original GitHub issueBug report
Describe the bug
Errors are shown in the logs when trying to import child_process in an api function.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Create an api function
// /pages/api/hello.js
import 'child_process';
export default (req, res) => {
res.end('hello');
};
- start next dev server
- visit
http://localhost:3000/api/helloin the browser - See error
[ error ] ./pages/api/hello.js
Module not found: Can't resolve 'child_process' in '<project-root>/pages/api'
Expected behavior
No error
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: macOS
- Version of Next.js: 8.1.1-canary.28
Additional context
Functionally there doesn’t seem to be any problem, looks like it’s just a logging problem.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Next.js API routes (and pages) should support reading files
It's currently not possible to read files from API routes or pages ... API(8.1.1-canary.28): error logged when importing child_process #7334.
Read more >Understanding Errors and Rejected Lines When Importing ...
We are reproducing the same steps as above through API calls; Let's import data in a module with the incorrect mapping (spelling error...
Read more >An error appears when importing data from Google Drive in ...
Solution. Follow the "message" entry in the DSS error log to go to the Google Developer console and enable the Google Drive API....
Read more >Resolve import errors API | Kibana Guide [8.5] - Elastic
Resolve errors from the Import objects API. To resolve errors, you can: Retry certain saved objects; Overwrite specific saved objects; Change references to ......
Read more >500 - Unexpected error while importing wsdl
While loading a particular wsdl, it loads successfully in the browser. But when i try to import the same via API manager, it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m aware, just test driving new features. I can hold off on opening a ticket like this if you think it’s too early, or report somewhere else.
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.