Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.s 9 | API | graphql - Can't resolve 'fs' in /api/index.ts #8134

Closed
mzygmunt opened this issue Jul 27, 2019 · 6 comments · Fixed by #8167
Closed

Next.s 9 | API | graphql - Can't resolve 'fs' in /api/index.ts #8134

mzygmunt opened this issue Jul 27, 2019 · 6 comments · Fixed by #8167
Assignees
Milestone

Comments

@mzygmunt
Copy link

Examples bug report

Example name

api-routes-graphql

Describe the bug

When I changed the name of the GraphQL API file from /api/graphql.js to /api/index.js, I noticed that the following error appears when building (after executing next build)

Failed to compile.
./node_modules/busboy/lib/main.js
Module not found: Can't resolve 'fs' in '/Users/mzygmunt/apps/next.js/examples/api-routes-graphql/node_modules/busboy/lib'
Build error occurred
Error: > Build failed because of webpack errors
at build (/Users/mzygmunt/apps/next.js/examples/api-routes-graphql/node_modules/next/dist/build/index.js:6:847)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api-routes-graphql@1.0.0 build: next build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api-routes-graphql@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mzygmunt/.npm/_logs/2019-07-27T09_46_44_792Z-debug.log

To Reproduce

  1. Clone example api-routes-graphql
  2. Change filename /api/graphql.js to /api/index.js
  3. Execure npm run build
  4. See error

Expected behavior

After changing the file name, API should be available at /api.

Screenshots

image

System information

  • OS: macOS
  • Browser (if applies) chrome
  • Version of Next.js: 9.0.2 - 9.0.3-canary.3
@timneutkens
Copy link
Member

I think @huv1k fixed this yesterday.

@timneutkens
Copy link
Member

timneutkens commented Jul 27, 2019

Publishing a new canary version right now so that you can verify. https://github.com/zeit/next.js/releases/tag/v9.0.3-canary.4

It might take a few minutes for it to show up on npm!

@mzygmunt
Copy link
Author

The problem is still occurs in the canary.4.

@huv1k
Copy link
Contributor

huv1k commented Jul 28, 2019

Hey @mzygmunt, could you share minimal reproduction?

@mzygmunt
Copy link
Author

Here you are https://github.com/mzygmunt/api-routes-graphql-example
Clone & npm install & npm run build

@balazsorban44
Copy link
Member

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 vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants